linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] extcon: return error code on failure
@ 2016-12-03  8:56 Pan Bian
  2016-12-03 12:48 ` Chanwoo Choi
  0 siblings, 1 reply; 3+ messages in thread
From: Pan Bian @ 2016-12-03  8:56 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi; +Cc: linux-kernel, Pan Bian

Function get_zeroed_page() returns a NULL pointer if there is no enough
memory. In function extcon_sync(), it returns 0 if the call to
get_zeroed_page() fails. The return value 0 indicates success in the
context, which is incosistent with the execution status. This patch
fixes the bug by returning -ENOMEM. 

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188611

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/extcon/extcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 7829846..7c1e3a7 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
 		dev_err(&edev->dev, "out of memory in extcon_set_state\n");
 		kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE);
 
-		return 0;
+		return -ENOMEM;
 	}
 
 	length = name_show(&edev->dev, NULL, prop_buf);
-- 
1.9.1

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

* Re: [PATCH 1/1] extcon: return error code on failure
  2016-12-03  8:56 [PATCH 1/1] extcon: return error code on failure Pan Bian
@ 2016-12-03 12:48 ` Chanwoo Choi
  2016-12-03 12:52   ` Chanwoo Choi
  0 siblings, 1 reply; 3+ messages in thread
From: Chanwoo Choi @ 2016-12-03 12:48 UTC (permalink / raw)
  To: Pan Bian, Greg KH; +Cc: MyungJoo Ham, Chanwoo Choi, linux-kernel

Hi Pan,

2016-12-03 17:56 GMT+09:00 Pan Bian <bianpan2016@163.com>:
> Function get_zeroed_page() returns a NULL pointer if there is no enough
> memory. In function extcon_sync(), it returns 0 if the call to
> get_zeroed_page() fails. The return value 0 indicates success in the
> context, which is incosistent with the execution status. This patch
> fixes the bug by returning -ENOMEM.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188611
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  drivers/extcon/extcon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 7829846..7c1e3a7 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
>                 dev_err(&edev->dev, "out of memory in extcon_set_state\n");
>                 kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE);
>
> -               return 0;
> +               return -ENOMEM;
>         }
>
>         length = name_show(&edev->dev, NULL, prop_buf);
> --
> 1.9.1
>
>

Looks good to me.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

Best Regards,
Chanwoo Choi

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

* Re: [PATCH 1/1] extcon: return error code on failure
  2016-12-03 12:48 ` Chanwoo Choi
@ 2016-12-03 12:52   ` Chanwoo Choi
  0 siblings, 0 replies; 3+ messages in thread
From: Chanwoo Choi @ 2016-12-03 12:52 UTC (permalink / raw)
  To: Pan Bian, Greg KH; +Cc: MyungJoo Ham, Chanwoo Choi, linux-kernel

Dear Greg,

2016-12-03 21:48 GMT+09:00 Chanwoo Choi <cwchoi00@gmail.com>:
> Hi Pan,
>
> 2016-12-03 17:56 GMT+09:00 Pan Bian <bianpan2016@163.com>:
>> Function get_zeroed_page() returns a NULL pointer if there is no enough
>> memory. In function extcon_sync(), it returns 0 if the call to
>> get_zeroed_page() fails. The return value 0 indicates success in the
>> context, which is incosistent with the execution status. This patch
>> fixes the bug by returning -ENOMEM.
>>
>> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188611
>>
>> Signed-off-by: Pan Bian <bianpan2016@163.com>
>> ---
>>  drivers/extcon/extcon.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
>> index 7829846..7c1e3a7 100644
>> --- a/drivers/extcon/extcon.c
>> +++ b/drivers/extcon/extcon.c
>> @@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
>>                 dev_err(&edev->dev, "out of memory in extcon_set_state\n");
>>                 kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE);
>>
>> -               return 0;
>> +               return -ENOMEM;
>>         }
>>
>>         length = name_show(&edev->dev, NULL, prop_buf);
>> --
>> 1.9.1
>>
>>
>
> Looks good to me.
>
> Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

This patch fixed the issue extcon_sync's patch[1].
I think this patch should be applied on v4.9.
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=a580982f0836e079171f65f22d82768a12f85570

Could you please pick this patch on your char-msic.git treedirectly?

-- 
Best Regards,
Chanwoo Choi

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

end of thread, other threads:[~2016-12-03 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-03  8:56 [PATCH 1/1] extcon: return error code on failure Pan Bian
2016-12-03 12:48 ` Chanwoo Choi
2016-12-03 12:52   ` Chanwoo Choi

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).