> -----Original Message----- > From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> > Sent: Monday, May 06, 2019 3:07 PM > To: Vadim Pasternak <vadimp@xxxxxxxxxxxx> > Cc: Darren Hart <dvhart@xxxxxxxxxxxxx>; Platform Driver <platform-driver- > x86@xxxxxxxxxxxxxxx>; michealsh@xxxxxxxxxxxx > Subject: Re: [PATCH v1 platform-next 0/2] platform/x86: Mellanox: add new > features > > 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() O, yes, I see. So all is OK. > > -- > With Best Regards, > Andy Shevchenko