diff mbox series

fsi: Fix an IS_ERR() vs NULL check in occ_probe()

Message ID 20200901120156.140522-1-jingxiangfeng@huawei.com
State New
Headers show
Series fsi: Fix an IS_ERR() vs NULL check in occ_probe() | expand

Commit Message

Jing Xiangfeng Sept. 1, 2020, 12:01 p.m. UTC
The platform_device_register_full() function returns error pointers,
it never returns NULL.

Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
 drivers/fsi/fsi-occ.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joel Stanley Sept. 2, 2020, 12:30 a.m. UTC | #1
On Tue, 1 Sep 2020 at 12:01, Jing Xiangfeng <jingxiangfeng@huawei.com> wrote:
>
> The platform_device_register_full() function returns error pointers,
> it never returns NULL.
>
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>

Thanks for the patch. I already have this change queued up for 5.10.

> ---
>  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
>
diff mbox series

Patch

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;