Hi Wei, On 09/13/2016 04:58 PM, Wei Yongjun wrote:
From: Wei Yongjun <weiyongjun1@xxxxxxxxxx> 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@xxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html