Re: [PATCH v1 platform-next 0/2] platform/x86: Mellanox: add new features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 6, 2019 at 1:12 PM Vadim Pasternak <vadimp@xxxxxxxxxxxx> wrote:

> > > > I have added one patch on top, please, check if it's okay with you.

> > http://git.infradead.org/linux-platform-drivers-
> > x86.git/commit/771fb643f668527985addad2e40b4dc17bac9170

> I am not sure about this:
>         for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0 ; i--) {
> -               if (mlxplat_wd_data[i])
> -                       platform_device_unregister(priv->pdev_wd[i]);
> -       }
> +               platform_device_unregister(priv->pdev_wd[i]);
>
> For some systems we have only one watchdog instance:
> mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0];
> while for others two instances
>         for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++)
>                 mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i];
>
> So, in the first case we will have NULL for
> platform_device_unregister(priv->pdev_wd[1]);

The following commit adds an IS_ERR() check on top for long existing NULL check.
The latter is what you are trying to do and effectively means double
check for NULL.

commit 99fef587ff98894426d9bf1f5b7336345052d4b3
Author: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Date:   Mon Dec 3 20:21:41 2018 +0200

   driver core: platform: Respect return code of platform_device_register_full()

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux