linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2/3] usb: gadget: storage: Add error handling for no memory
@ 2018-06-14  9:23 Jaejoong Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Jaejoong Kim @ 2018-06-14  9:23 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Krzysztof Opasiak, Alan Stern; +Cc: linux-usb

fsg_common_set_num_buffers() may fail due to ENOMEM. So add
error handling for fail case.

Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
---
 drivers/usb/gadget/function/f_mass_storage.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 83eeafe..b6e2930 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:

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [2/3] usb: gadget: storage: Add error handling for no memory
@ 2018-06-14 14:50 Alan Stern
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2018-06-14 14:50 UTC (permalink / raw)
  To: Jaejoong Kim
  Cc: Michal Nazarewicz, Felipe Balbi, Greg Kroah-Hartman,
	Krzysztof Opasiak, USB list

On Thu, 14 Jun 2018, Jaejoong Kim wrote:

> fsg_common_set_num_buffers() may fail due to ENOMEM. So add
> error handling for fail case.
> 
> Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
> ---
>  drivers/usb/gadget/function/f_mass_storage.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
> index 83eeafe..b6e2930 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:

Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [2/3] usb: gadget: storage: Add error handling for no memory
@ 2018-06-26  8:37 Michał Nazarewicz
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Nazarewicz @ 2018-06-26  8:37 UTC (permalink / raw)
  To: Alan Stern
  Cc: Jaejoong Kim, Felipe Balbi, Greg Kroah-Hartman, Krzysztof Opasiak,
	USB list

Acked-by: Michal Nazarewicz <mina86@mina86.com>

(Does Gmail still hates LKML? Guess we’ll see…)

2018-06-14 15:50 GMT+01:00 Alan Stern <stern@rowland.harvard.edu>:
> On Thu, 14 Jun 2018, Jaejoong Kim wrote:
>
>> fsg_common_set_num_buffers() may fail due to ENOMEM. So add
>> error handling for fail case.
>>
>> Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
>> ---
>>  drivers/usb/gadget/function/f_mass_storage.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
>> index 83eeafe..b6e2930 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:
>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-26  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-14  9:23 [2/3] usb: gadget: storage: Add error handling for no memory Jaejoong Kim
  -- strict thread matches above, loose matches on Subject: below --
2018-06-14 14:50 Alan Stern
2018-06-26  8:37 Michał Nazarewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).