diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/function/f_midi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 259b656c0b3e..6316aa5b1c49 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c | |||
@@ -973,7 +973,13 @@ static ssize_t f_midi_opts_id_show(struct f_midi_opts *opts, char *page) | |||
973 | int result; | 973 | int result; |
974 | 974 | ||
975 | mutex_lock(&opts->lock); | 975 | mutex_lock(&opts->lock); |
976 | result = strlcpy(page, opts->id, PAGE_SIZE); | 976 | if (opts->id) { |
977 | result = strlcpy(page, opts->id, PAGE_SIZE); | ||
978 | } else { | ||
979 | page[0] = 0; | ||
980 | result = 0; | ||
981 | } | ||
982 | |||
977 | mutex_unlock(&opts->lock); | 983 | mutex_unlock(&opts->lock); |
978 | 984 | ||
979 | return result; | 985 | return result; |