linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsi: fsi-occ: fix return value check in occ_probe()
@ 2020-07-13  3:33 Xu Wang
  2020-07-13 14:21 ` Eddie James
  2020-07-20 14:44 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Xu Wang @ 2020-07-13  3:33 UTC (permalink / raw)
  To: jk, joel, alistair, eajames, linux-fsi; +Cc: linux-kernel, Xu Wang

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

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/fsi/fsi-occ.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index 7da9c81759ac..9eeb856c8905 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -555,7 +555,7 @@ static int occ_probe(struct platform_device *pdev)
 
 	hwmon_dev_info.id = occ->idx;
 	hwmon_dev = platform_device_register_full(&hwmon_dev_info);
-	if (!hwmon_dev)
+	if (IS_ERR(hwmon_dev))
 		dev_warn(dev, "failed to create hwmon device\n");
 
 	return 0;
-- 
2.17.1


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

* Re: [PATCH] fsi: fsi-occ: fix return value check in occ_probe()
  2020-07-13  3:33 [PATCH] fsi: fsi-occ: fix return value check in occ_probe() Xu Wang
@ 2020-07-13 14:21 ` Eddie James
  2020-07-20 14:44 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Eddie James @ 2020-07-13 14:21 UTC (permalink / raw)
  To: Xu Wang, jk, joel, alistair, linux-fsi; +Cc: linux-kernel


On 7/12/20 10:33 PM, Xu Wang wrote:
> In case of error, the function platform_device_register_full()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().


Thanks,

Reviewed-by: Eddie James <eajames@linux.ibm.com>


>
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>   drivers/fsi/fsi-occ.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
> index 7da9c81759ac..9eeb856c8905 100644
> --- a/drivers/fsi/fsi-occ.c
> +++ b/drivers/fsi/fsi-occ.c
> @@ -555,7 +555,7 @@ static int occ_probe(struct platform_device *pdev)
>   
>   	hwmon_dev_info.id = occ->idx;
>   	hwmon_dev = platform_device_register_full(&hwmon_dev_info);
> -	if (!hwmon_dev)
> +	if (IS_ERR(hwmon_dev))
>   		dev_warn(dev, "failed to create hwmon device\n");
>   
>   	return 0;

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

* Re: [PATCH] fsi: fsi-occ: fix return value check in occ_probe()
  2020-07-13  3:33 [PATCH] fsi: fsi-occ: fix return value check in occ_probe() Xu Wang
  2020-07-13 14:21 ` Eddie James
@ 2020-07-20 14:44 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2020-07-20 14:44 UTC (permalink / raw)
  To: Xu Wang, jk, joel, alistair, eajames, linux-fsi; +Cc: linux-kernel

On 7/12/20 8:33 PM, Xu Wang wrote:
> In case of error, the function platform_device_register_full()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/fsi/fsi-occ.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
> index 7da9c81759ac..9eeb856c8905 100644
> --- a/drivers/fsi/fsi-occ.c
> +++ b/drivers/fsi/fsi-occ.c
> @@ -555,7 +555,7 @@ static int occ_probe(struct platform_device *pdev)
>  
>  	hwmon_dev_info.id = occ->idx;
>  	hwmon_dev = platform_device_register_full(&hwmon_dev_info);
> -	if (!hwmon_dev)
> +	if (IS_ERR(hwmon_dev))
>  		dev_warn(dev, "failed to create hwmon device\n");
>  
>  	return 0;
> 


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

end of thread, other threads:[~2020-07-20 14:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13  3:33 [PATCH] fsi: fsi-occ: fix return value check in occ_probe() Xu Wang
2020-07-13 14:21 ` Eddie James
2020-07-20 14:44 ` Guenter Roeck

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