leds: mlxcpld: fix return value check in mlxcpld_led_init()
Subsystems (2)
PATCH 1/1 leds: mlxcpld: fix return value check in mlxcpld_led_init()
From: Wei Yongjun <[email protected]>
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().
--- drivers/leds/leds-mlxcpld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-mlxcpld.c +2 -2
@@ -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);
Hi Wei,
Quoted 21 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
platform_device_register_simple()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Signed-off-by Wei Yongjun <[email protected]>--- drivers/leds/leds-mlxcpld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/leds/leds-mlxcpld.c +0
-0@@ -401,9 +401,9 @@ static int __init mlxcpld_led_init(void)int err;
drivers/leds/leds-mlxcpld.c static int __init mlxcpld_led_init(void) · line 409
Quoted 10 lines
drivers/leds/leds-mlxcpld.c +2
-2pdev =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?
Signature · 2 lines
Best regards, Jacek Anaszewski
Hi Jacek,
Quoted 8 lines
-----Original Message-----
From: Jacek Anaszewski [mailto:[email protected]]
Sent: Wednesday, September 14, 2016 2:56 PM
To: Wei Yongjun; Vadim Pasternak; Richard Purdie
Cc: weiyongjun (A); [email protected]
Subject: Re: [PATCH -next] leds: mlxcpld: fix return value check inmlxcpld_led_init()
Quoted 5 lines
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
Jacek Anaszewski
Reviewed-by Wei YongjunQuoted 10 lines · weiyongjun (A)
Hi Jacek,
Quoted 8 lines
-----Original Message-----
From: Jacek Anaszewski [mailto:[email protected]]
Sent: Wednesday, September 14, 2016 2:56 PM
To: Wei Yongjun; Vadim Pasternak; Richard Purdie
Cc: weiyongjun (A); [email protected]
Subject: Re: [PATCH -next] leds: mlxcpld: fix return value check inmlxcpld_led_init()
Quoted 7 lines
Quoted 5 lines
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:
Signature · 2 lines
Best regards, Jacek Anaszewski