All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] leds: mlxcpld: fix return value check in mlxcpld_led_init()
@ 2016-09-13 14:58 ` Wei Yongjun
  2016-09-14  6:55   ` Jacek Anaszewski
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2016-09-13 14:58 UTC (permalink / raw)
  To: Vadim Pasternak, Richard Purdie, Jacek Anaszewski; +Cc: Wei Yongjun, linux-leds

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function platform_device_register_simple() returns
ERR_PTR() and never returns NULL. The NULL test in the return value
check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/leds/leds-mlxcpld.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/leds-mlxcpld.c b/drivers/leds/leds-mlxcpld.c
index 125ddfa..2ba76c1 100644
--- a/drivers/leds/leds-mlxcpld.c
+++ b/drivers/leds/leds-mlxcpld.c
@@ -401,9 +401,9 @@ static int __init mlxcpld_led_init(void)
 	int err;
 
 	pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0);
-	if (!pdev) {
+	if (IS_ERR(pdev)) {
 		pr_err("Device allocation failed\n");
-		return -ENOMEM;
+		return PTR_ERR(pdev);
 	}
 
 	err = platform_driver_probe(&mlxcpld_led_driver, mlxcpld_led_probe);

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

* Re: [PATCH -next] leds: mlxcpld: fix return value check in mlxcpld_led_init()
  2016-09-13 14:58 ` [PATCH -next] leds: mlxcpld: fix return value check in mlxcpld_led_init() Wei Yongjun
@ 2016-09-14  6:55   ` Jacek Anaszewski
  2016-09-14  7:10     ` weiyongjun (A)
  0 siblings, 1 reply; 4+ messages in thread
From: Jacek Anaszewski @ 2016-09-14  6:55 UTC (permalink / raw)
  To: Wei Yongjun, Vadim Pasternak, Richard Purdie; +Cc: Wei Yongjun, linux-leds

Hi Wei,

On 09/13/2016 04:58 PM, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> In case of error, the function platform_device_register_simple() returns
> ERR_PTR() and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/leds/leds-mlxcpld.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/leds-mlxcpld.c b/drivers/leds/leds-mlxcpld.c
> index 125ddfa..2ba76c1 100644
> --- a/drivers/leds/leds-mlxcpld.c
> +++ b/drivers/leds/leds-mlxcpld.c
> @@ -401,9 +401,9 @@ static int __init mlxcpld_led_init(void)
>  	int err;
>
>  	pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0);
> -	if (!pdev) {
> +	if (IS_ERR(pdev)) {
>  		pr_err("Device allocation failed\n");
> -		return -ENOMEM;
> +		return PTR_ERR(pdev);
>  	}
>
>  	err = platform_driver_probe(&mlxcpld_led_driver, mlxcpld_led_probe);
>
>
>
>

Thanks for your patches. Would you mind if I merged them to the
original patch and added your Reviewed-by tag to the commit message?

-- 
Best regards,
Jacek Anaszewski

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

* RE: [PATCH -next] leds: mlxcpld: fix return value check in mlxcpld_led_init()
  2016-09-14  6:55   ` Jacek Anaszewski
@ 2016-09-14  7:10     ` weiyongjun (A)
  2016-09-14  8:56       ` Jacek Anaszewski
  0 siblings, 1 reply; 4+ messages in thread
From: weiyongjun (A) @ 2016-09-14  7:10 UTC (permalink / raw)
  To: Jacek Anaszewski, Wei Yongjun, Vadim Pasternak, Richard Purdie; +Cc: linux-leds

Hi Jacek,

> -----Original Message-----
> From: Jacek Anaszewski [mailto:j.anaszewski@samsung.com]
> Sent: Wednesday, September 14, 2016 2:56 PM
> To: Wei Yongjun; Vadim Pasternak; Richard Purdie
> Cc: weiyongjun (A); linux-leds@vger.kernel.org
> Subject: Re: [PATCH -next] leds: mlxcpld: fix return value check in
> mlxcpld_led_init()
> 
> Hi Wei,
> 
> 
> Thanks for your patches. Would you mind if I merged them to the
> original patch and added your Reviewed-by tag to the commit message?

Feel free to merge them, it is ok with me.

Regards,
Yongjun Wei

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

* Re: [PATCH -next] leds: mlxcpld: fix return value check in mlxcpld_led_init()
  2016-09-14  7:10     ` weiyongjun (A)
@ 2016-09-14  8:56       ` Jacek Anaszewski
  0 siblings, 0 replies; 4+ messages in thread
From: Jacek Anaszewski @ 2016-09-14  8:56 UTC (permalink / raw)
  To: weiyongjun (A), Wei Yongjun, Vadim Pasternak, Richard Purdie; +Cc: linux-leds

On 09/14/2016 09:10 AM, weiyongjun (A) wrote:
> Hi Jacek,
>
>> -----Original Message-----
>> From: Jacek Anaszewski [mailto:j.anaszewski@samsung.com]
>> Sent: Wednesday, September 14, 2016 2:56 PM
>> To: Wei Yongjun; Vadim Pasternak; Richard Purdie
>> Cc: weiyongjun (A); linux-leds@vger.kernel.org
>> Subject: Re: [PATCH -next] leds: mlxcpld: fix return value check in
>> mlxcpld_led_init()
>>
>> Hi Wei,
>>
>>
>> Thanks for your patches. Would you mind if I merged them to the
>> original patch and added your Reviewed-by tag to the commit message?
>
> Feel free to merge them, it is ok with me.

Patches merged. I added also to the commit message the tag:

Reviewed-by: Wei Yongjun <weiyongjun1@huawei.com>

-- 
Best regards,
Jacek Anaszewski

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

end of thread, other threads:[~2016-09-14  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20160913145849eucas1p1c1661ef621a39d2955b29710a3729e7b@eucas1p1.samsung.com>
2016-09-13 14:58 ` [PATCH -next] leds: mlxcpld: fix return value check in mlxcpld_led_init() Wei Yongjun
2016-09-14  6:55   ` Jacek Anaszewski
2016-09-14  7:10     ` weiyongjun (A)
2016-09-14  8:56       ` Jacek Anaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.