* [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
[not found] <20171031142149.32512-1-andriy.shevchenko@linux.intel.com>
@ 2017-10-31 14:21 ` Andy Shevchenko
2017-10-31 18:03 ` Jean Delvare
2017-11-01 13:19 ` Guenter Roeck
2017-10-31 14:21 ` [PATCH v1 10/15] hwmon: (w83791d) " Andy Shevchenko
` (2 subsequent siblings)
3 siblings, 2 replies; 12+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
To: linux-i2c, Wolfram Sang
Cc: Andy Shevchenko, Jean Delvare, Guenter Roeck, linux-hwmon
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/hwmon/w83781d.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 246fb2365126..2b0f182daa87 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id)
exit_remove_files:
w83781d_remove_files(dev);
- if (data->lm75[0])
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1])
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
return err;
}
@@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)
hwmon_device_unregister(data->hwmon_dev);
w83781d_remove_files(dev);
- if (data->lm75[0])
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1])
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
return 0;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
2017-10-31 14:21 ` [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check Andy Shevchenko
@ 2017-10-31 18:03 ` Jean Delvare
2017-11-01 13:19 ` Guenter Roeck
1 sibling, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2017-10-31 18:03 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-i2c, Wolfram Sang, Jean Delvare, Guenter Roeck, linux-hwmon
On Tue, 31 Oct 2017 16:21:43 +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/hwmon/w83781d.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
> index 246fb2365126..2b0f182daa87 100644
> --- a/drivers/hwmon/w83781d.c
> +++ b/drivers/hwmon/w83781d.c
> @@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id)
>
> exit_remove_files:
> w83781d_remove_files(dev);
> - if (data->lm75[0])
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1])
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
> return err;
> }
>
> @@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)
> hwmon_device_unregister(data->hwmon_dev);
> w83781d_remove_files(dev);
>
> - if (data->lm75[0])
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1])
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
>
> return 0;
> }
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
2017-10-31 14:21 ` [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check Andy Shevchenko
2017-10-31 18:03 ` Jean Delvare
@ 2017-11-01 13:19 ` Guenter Roeck
2017-11-01 13:26 ` Andy Shevchenko
1 sibling, 1 reply; 12+ messages in thread
From: Guenter Roeck @ 2017-11-01 13:19 UTC (permalink / raw)
To: Andy Shevchenko, linux-i2c, Wolfram Sang; +Cc: Jean Delvare, linux-hwmon
On 10/31/2017 07:21 AM, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
I'll keep the hwmon patches from this series on hold until the changes
to i2c_unregister_device make it into the tree. Ok with me if the patches
are merged through some other tree.
Guenter
> ---
> drivers/hwmon/w83781d.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
> index 246fb2365126..2b0f182daa87 100644
> --- a/drivers/hwmon/w83781d.c
> +++ b/drivers/hwmon/w83781d.c
> @@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id)
>
> exit_remove_files:
> w83781d_remove_files(dev);
> - if (data->lm75[0])
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1])
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
> return err;
> }
>
> @@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)
> hwmon_device_unregister(data->hwmon_dev);
> w83781d_remove_files(dev);
>
> - if (data->lm75[0])
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1])
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
>
> return 0;
> }
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
2017-11-01 13:19 ` Guenter Roeck
@ 2017-11-01 13:26 ` Andy Shevchenko
2017-11-01 23:07 ` Wolfram Sang
0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2017-11-01 13:26 UTC (permalink / raw)
To: Guenter Roeck, linux-i2c, Wolfram Sang; +Cc: Jean Delvare, linux-hwmon
On Wed, 2017-11-01 at 06:19 -0700, Guenter Roeck wrote:
> On 10/31/2017 07:21 AM, Andy Shevchenko wrote:
> > Since i2c_unregister_device() became NULL-aware we may remove
> > duplicate
> > NULL check.
> >
> > Cc: Jean Delvare <jdelvare@suse.com>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: linux-hwmon@vger.kernel.org
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> I'll keep the hwmon patches from this series on hold until the changes
> to i2c_unregister_device make it into the tree. Ok with me if the
> patches
> are merged through some other tree.
Wolfram, what do you think?
At least we have couple of options:
- apply i2c core patch now and wait until rc1
- apply everything through i2c tree
- ...
>
> Guenter
>
> > ---
> > drivers/hwmon/w83781d.c | 12 ++++--------
> > 1 file changed, 4 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
> > index 246fb2365126..2b0f182daa87 100644
> > --- a/drivers/hwmon/w83781d.c
> > +++ b/drivers/hwmon/w83781d.c
> > @@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client,
> > const struct i2c_device_id *id)
> >
> > exit_remove_files:
> > w83781d_remove_files(dev);
> > - if (data->lm75[0])
> > - i2c_unregister_device(data->lm75[0]);
> > - if (data->lm75[1])
> > - i2c_unregister_device(data->lm75[1]);
> > + i2c_unregister_device(data->lm75[0]);
> > + i2c_unregister_device(data->lm75[1]);
> > return err;
> > }
> >
> > @@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)
> > hwmon_device_unregister(data->hwmon_dev);
> > w83781d_remove_files(dev);
> >
> > - if (data->lm75[0])
> > - i2c_unregister_device(data->lm75[0]);
> > - if (data->lm75[1])
> > - i2c_unregister_device(data->lm75[1]);
> > + i2c_unregister_device(data->lm75[0]);
> > + i2c_unregister_device(data->lm75[1]);
> >
> > return 0;
> > }
> >
>
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
2017-11-01 13:26 ` Andy Shevchenko
@ 2017-11-01 23:07 ` Wolfram Sang
2017-11-02 12:23 ` Andy Shevchenko
0 siblings, 1 reply; 12+ messages in thread
From: Wolfram Sang @ 2017-11-01 23:07 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Guenter Roeck, linux-i2c, Jean Delvare, linux-hwmon
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
> > I'll keep the hwmon patches from this series on hold until the changes
> > to i2c_unregister_device make it into the tree. Ok with me if the
> > patches
> > are merged through some other tree.
>
> Wolfram, what do you think?
>
> At least we have couple of options:
> - apply i2c core patch now and wait until rc1
> - apply everything through i2c tree
> - ...
I just applied patches 1-3 to my for-4.15 branch. So, other subsystems
could pick it at rc1 time. If you are going to resend, you can add my
Acked-by: Wolfram Sang <wsa@the-dreams.de>
to all of the remaining patches.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
2017-11-01 23:07 ` Wolfram Sang
@ 2017-11-02 12:23 ` Andy Shevchenko
0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2017-11-02 12:23 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Guenter Roeck, linux-i2c, Jean Delvare, linux-hwmon
On Thu, 2017-11-02 at 00:07 +0100, Wolfram Sang wrote:
> > > I'll keep the hwmon patches from this series on hold until the
> > > changes
> > > to i2c_unregister_device make it into the tree. Ok with me if the
> > > patches
> > > are merged through some other tree.
> >
> > Wolfram, what do you think?
> >
> > At least we have couple of options:
> > - apply i2c core patch now and wait until rc1
> > - apply everything through i2c tree
> > - ...
>
> I just applied patches 1-3 to my for-4.15 branch. So, other subsystems
> could pick it at rc1 time. If you are going to resend, you can add my
>
> Acked-by: Wolfram Sang <wsa@the-dreams.de>
>
> to all of the remaining patches.
Noted, thanks!
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v1 10/15] hwmon: (w83791d) Remove duplicate NULL check
[not found] <20171031142149.32512-1-andriy.shevchenko@linux.intel.com>
2017-10-31 14:21 ` [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
2017-10-31 18:27 ` Jean Delvare
2017-10-31 14:21 ` [PATCH v1 11/15] hwmon: (w83792d) " Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 12/15] hwmon: (w83793) " Andy Shevchenko
3 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
To: linux-i2c, Wolfram Sang
Cc: Andy Shevchenko, Marc Hulsman, Jean Delvare, Guenter Roeck,
linux-hwmon
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.
Cc: Marc Hulsman <m.hulsman@tudelft.nl>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/hwmon/w83791d.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index 8af6081b4ab4..28fa3bd2c096 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -1316,8 +1316,7 @@ static int w83791d_detect_subclients(struct i2c_client *client)
/* Undo inits in case of errors */
error_sc_1:
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[0]);
error_sc_0:
return err;
}
@@ -1434,10 +1433,8 @@ static int w83791d_probe(struct i2c_client *client,
error4:
sysfs_remove_group(&client->dev.kobj, &w83791d_group);
error3:
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1] != NULL)
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
return err;
}
@@ -1448,10 +1445,8 @@ static int w83791d_remove(struct i2c_client *client)
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &w83791d_group);
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1] != NULL)
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
return 0;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v1 10/15] hwmon: (w83791d) Remove duplicate NULL check
2017-10-31 14:21 ` [PATCH v1 10/15] hwmon: (w83791d) " Andy Shevchenko
@ 2017-10-31 18:27 ` Jean Delvare
0 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2017-10-31 18:27 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-i2c, Wolfram Sang, Marc Hulsman, Guenter Roeck, linux-hwmon
On Tue, 31 Oct 2017 16:21:44 +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
>
> Cc: Marc Hulsman <m.hulsman@tudelft.nl>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/hwmon/w83791d.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
> index 8af6081b4ab4..28fa3bd2c096 100644
> --- a/drivers/hwmon/w83791d.c
> +++ b/drivers/hwmon/w83791d.c
> @@ -1316,8 +1316,7 @@ static int w83791d_detect_subclients(struct i2c_client *client)
> /* Undo inits in case of errors */
>
> error_sc_1:
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[0]);
> error_sc_0:
> return err;
> }
> @@ -1434,10 +1433,8 @@ static int w83791d_probe(struct i2c_client *client,
> error4:
> sysfs_remove_group(&client->dev.kobj, &w83791d_group);
> error3:
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1] != NULL)
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
> return err;
> }
>
> @@ -1448,10 +1445,8 @@ static int w83791d_remove(struct i2c_client *client)
> hwmon_device_unregister(data->hwmon_dev);
> sysfs_remove_group(&client->dev.kobj, &w83791d_group);
>
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1] != NULL)
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
>
> return 0;
> }
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v1 11/15] hwmon: (w83792d) Remove duplicate NULL check
[not found] <20171031142149.32512-1-andriy.shevchenko@linux.intel.com>
2017-10-31 14:21 ` [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 10/15] hwmon: (w83791d) " Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
2017-10-31 19:32 ` Jean Delvare
2017-10-31 14:21 ` [PATCH v1 12/15] hwmon: (w83793) " Andy Shevchenko
3 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
To: linux-i2c, Wolfram Sang
Cc: Andy Shevchenko, Jean Delvare, Guenter Roeck, linux-hwmon
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/hwmon/w83792d.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index d764602d70db..76aa39e537e0 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -981,8 +981,7 @@ w83792d_detect_subclients(struct i2c_client *new_client)
/* Undo inits in case of errors */
ERROR_SC_1:
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[0]);
ERROR_SC_0:
return err;
}
@@ -1456,10 +1455,8 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id)
for (i = 0; i < ARRAY_SIZE(w83792d_group_fan); i++)
sysfs_remove_group(&dev->kobj, &w83792d_group_fan[i]);
exit_i2c_unregister:
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1] != NULL)
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
return err;
}
@@ -1475,10 +1472,8 @@ w83792d_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj,
&w83792d_group_fan[i]);
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1] != NULL)
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
return 0;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v1 11/15] hwmon: (w83792d) Remove duplicate NULL check
2017-10-31 14:21 ` [PATCH v1 11/15] hwmon: (w83792d) " Andy Shevchenko
@ 2017-10-31 19:32 ` Jean Delvare
0 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2017-10-31 19:32 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-i2c, Wolfram Sang, Guenter Roeck, linux-hwmon
On Tue, 31 Oct 2017 16:21:45 +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/hwmon/w83792d.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
> index d764602d70db..76aa39e537e0 100644
> --- a/drivers/hwmon/w83792d.c
> +++ b/drivers/hwmon/w83792d.c
> @@ -981,8 +981,7 @@ w83792d_detect_subclients(struct i2c_client *new_client)
> /* Undo inits in case of errors */
>
> ERROR_SC_1:
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[0]);
> ERROR_SC_0:
> return err;
> }
> @@ -1456,10 +1455,8 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id)
> for (i = 0; i < ARRAY_SIZE(w83792d_group_fan); i++)
> sysfs_remove_group(&dev->kobj, &w83792d_group_fan[i]);
> exit_i2c_unregister:
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1] != NULL)
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
> return err;
> }
>
> @@ -1475,10 +1472,8 @@ w83792d_remove(struct i2c_client *client)
> sysfs_remove_group(&client->dev.kobj,
> &w83792d_group_fan[i]);
>
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1] != NULL)
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
>
> return 0;
> }
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v1 12/15] hwmon: (w83793) Remove duplicate NULL check
[not found] <20171031142149.32512-1-andriy.shevchenko@linux.intel.com>
` (2 preceding siblings ...)
2017-10-31 14:21 ` [PATCH v1 11/15] hwmon: (w83792d) " Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
2017-10-31 19:43 ` Jean Delvare
3 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
To: linux-i2c, Wolfram Sang
Cc: Andy Shevchenko, Rudolf Marek, Jean Delvare, Guenter Roeck,
linux-hwmon
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.
Cc: Rudolf Marek <r.marek@assembler.cz>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/hwmon/w83793.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index 5ba9d9f1daa1..0af0f6283b35 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -1564,10 +1564,8 @@ static int w83793_remove(struct i2c_client *client)
for (i = 0; i < ARRAY_SIZE(w83793_temp); i++)
device_remove_file(dev, &w83793_temp[i].dev_attr);
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1] != NULL)
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
/* Decrease data reference counter */
mutex_lock(&watchdog_data_mutex);
@@ -1625,8 +1623,7 @@ w83793_detect_subclients(struct i2c_client *client)
/* Undo inits in case of errors */
ERROR_SC_1:
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[0]);
ERROR_SC_0:
return err;
}
@@ -1962,10 +1959,8 @@ static int w83793_probe(struct i2c_client *client,
for (i = 0; i < ARRAY_SIZE(w83793_temp); i++)
device_remove_file(dev, &w83793_temp[i].dev_attr);
- if (data->lm75[0] != NULL)
- i2c_unregister_device(data->lm75[0]);
- if (data->lm75[1] != NULL)
- i2c_unregister_device(data->lm75[1]);
+ i2c_unregister_device(data->lm75[0]);
+ i2c_unregister_device(data->lm75[1]);
free_mem:
kfree(data);
exit:
--
2.14.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v1 12/15] hwmon: (w83793) Remove duplicate NULL check
2017-10-31 14:21 ` [PATCH v1 12/15] hwmon: (w83793) " Andy Shevchenko
@ 2017-10-31 19:43 ` Jean Delvare
0 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2017-10-31 19:43 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-i2c, Wolfram Sang, Rudolf Marek, Guenter Roeck, linux-hwmon
On Tue, 31 Oct 2017 16:21:46 +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
>
> Cc: Rudolf Marek <r.marek@assembler.cz>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/hwmon/w83793.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
> index 5ba9d9f1daa1..0af0f6283b35 100644
> --- a/drivers/hwmon/w83793.c
> +++ b/drivers/hwmon/w83793.c
> @@ -1564,10 +1564,8 @@ static int w83793_remove(struct i2c_client *client)
> for (i = 0; i < ARRAY_SIZE(w83793_temp); i++)
> device_remove_file(dev, &w83793_temp[i].dev_attr);
>
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1] != NULL)
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
>
> /* Decrease data reference counter */
> mutex_lock(&watchdog_data_mutex);
> @@ -1625,8 +1623,7 @@ w83793_detect_subclients(struct i2c_client *client)
> /* Undo inits in case of errors */
>
> ERROR_SC_1:
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[0]);
> ERROR_SC_0:
> return err;
> }
> @@ -1962,10 +1959,8 @@ static int w83793_probe(struct i2c_client *client,
> for (i = 0; i < ARRAY_SIZE(w83793_temp); i++)
> device_remove_file(dev, &w83793_temp[i].dev_attr);
>
> - if (data->lm75[0] != NULL)
> - i2c_unregister_device(data->lm75[0]);
> - if (data->lm75[1] != NULL)
> - i2c_unregister_device(data->lm75[1]);
> + i2c_unregister_device(data->lm75[0]);
> + i2c_unregister_device(data->lm75[1]);
> free_mem:
> kfree(data);
> exit:
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 12+ messages in thread