summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJaejoong Kim <climbbb.kim@gmail.com>2018-07-04 07:51:27 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-07-26 13:55:17 +0300
commit7a051e8de3010c2f5f52e0bf305ef96c1f1f19d5 (patch)
tree0c8484b7ebf7e4fbbed96ddbc4548c027562f8ec /drivers
parent211f658b7b40fd3355a0920481132645e24ffb16 (diff)
downloadlinux-7a051e8de3010c2f5f52e0bf305ef96c1f1f19d5.tar.xz
usb: gadget: storage: Add error handling for no memory
fsg_common_set_num_buffers() may fail due to ENOMEM. So add error handling for fail case. Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index acecd13dcbd9..1b580eb3f78f 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -3308,7 +3308,9 @@ static ssize_t fsg_opts_num_buffers_store(struct config_item *item,
if (ret)
goto end;
- fsg_common_set_num_buffers(opts->common, num);
+ ret = fsg_common_set_num_buffers(opts->common, num);
+ if (ret)
+ goto end;
ret = len;
end: