All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware
@ 2017-10-31 14:21 Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check Andy Shevchenko
                   ` (14 more replies)
  0 siblings, 15 replies; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko

It's a common pattern to be NULL-aware when freeing resources.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/i2c-core-base.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 56e46581b84b..6735c9365430 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -808,6 +808,8 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
  */
 void i2c_unregister_device(struct i2c_client *client)
 {
+	if (!client)
+		return;
 	if (client->dev.of_node)
 		of_node_clear_flag(client->dev.of_node, OF_POPULATED);
 	if (ACPI_COMPANION(&client->dev))
@@ -1417,8 +1419,7 @@ static int __unregister_client(struct device *dev, void *dummy)
 static int __unregister_dummy(struct device *dev, void *dummy)
 {
 	struct i2c_client *client = i2c_verify_client(dev);
-	if (client)
-		i2c_unregister_device(client);
+	i2c_unregister_device(client);
 	return 0;
 }
 
-- 
2.14.2

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

* [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-10-31 17:34   ` Jean Delvare
  2017-11-01 23:04   ` Wolfram Sang
  2017-10-31 14:21 ` [PATCH v1 03/15] i2c: thunderx: " Andy Shevchenko
                   ` (13 subsequent siblings)
  14 siblings, 2 replies; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko, Jean Delvare

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Jean Delvare <jdelvare@suse.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-taos-evm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c
index addd90a8cb59..7c7fc01116a1 100644
--- a/drivers/i2c/busses/i2c-taos-evm.c
+++ b/drivers/i2c/busses/i2c-taos-evm.c
@@ -282,8 +282,7 @@ static void taos_disconnect(struct serio *serio)
 {
 	struct taos_data *taos = serio_get_drvdata(serio);
 
-	if (taos->client)
-		i2c_unregister_device(taos->client);
+	i2c_unregister_device(taos->client);
 	i2c_del_adapter(&taos->adapter);
 	serio_close(serio);
 	kfree(taos);
-- 
2.14.2

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

* [PATCH v1 03/15] i2c: thunderx: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-11-01 23:04   ` Wolfram Sang
  2017-10-31 14:21 ` [PATCH v1 04/15] ipmi_ssif: " Andy Shevchenko
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko, Jan Glauber, David Daney

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Jan Glauber <jglauber@cavium.com>
Cc: David Daney <david.daney@cavium.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-thunderx-pcidrv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index df0976f4432a..61866646ae8e 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -149,8 +149,7 @@ static int thunder_i2c_smbus_setup(struct octeon_i2c *i2c,
 
 static void thunder_i2c_smbus_remove(struct octeon_i2c *i2c)
 {
-	if (i2c->ara)
-		i2c_unregister_device(i2c->ara);
+	i2c_unregister_device(i2c->ara);
 }
 
 static int thunder_i2c_probe_pci(struct pci_dev *pdev,
-- 
2.14.2

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

* [PATCH v1 04/15] ipmi_ssif: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 03/15] i2c: thunderx: " Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2018-01-18 15:29   ` Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 05/15] gpio: max732x: " Andy Shevchenko
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: openipmi-developer, Andy Shevchenko, Corey Minyard

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Corey Minyard <minyard@acm.org>
Cc: openipmi-developer@lists.sourceforge.net
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/char/ipmi/ipmi_ssif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 466b3a1c0adf..8d183e182eab 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -2072,8 +2072,7 @@ static int ssif_platform_remove(struct platform_device *dev)
 		return 0;
 
 	mutex_lock(&ssif_infos_mutex);
-	if (addr_info->client)
-		i2c_unregister_device(addr_info->client);
+	i2c_unregister_device(addr_info->client);
 
 	list_del(&addr_info->link);
 	kfree(addr_info);
-- 
2.14.2


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* [PATCH v1 05/15] gpio: max732x: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (2 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 04/15] ipmi_ssif: " Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-11-29 12:26   ` Linus Walleij
  2017-10-31 14:21 ` [PATCH v1 06/15] drm/bridge: analogix-anx78xx: " Andy Shevchenko
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko, Linus Walleij, linux-gpio

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-max732x.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 7f4d26ce5f23..5fc2efd837fd 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -709,8 +709,7 @@ static int max732x_probe(struct i2c_client *client,
 	return 0;
 
 out_failed:
-	if (chip->client_dummy)
-		i2c_unregister_device(chip->client_dummy);
+	i2c_unregister_device(chip->client_dummy);
 	return ret;
 }
 
@@ -734,8 +733,7 @@ static int max732x_remove(struct i2c_client *client)
 	gpiochip_remove(&chip->gpio_chip);
 
 	/* unregister any dummy i2c_client */
-	if (chip->client_dummy)
-		i2c_unregister_device(chip->client_dummy);
+	i2c_unregister_device(chip->client_dummy);
 
 	return 0;
 }
-- 
2.14.2

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

* [PATCH v1 06/15] drm/bridge: analogix-anx78xx: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (3 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 05/15] gpio: max732x: " Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 07/15] drm/i2c/sil164: " Andy Shevchenko
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: Andy Shevchenko, Archit Taneja, Andrzej Hajda, Laurent Pinchart,
	David Airlie, dri-devel

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Archit Taneja <architt@codeaurora.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/bridge/analogix-anx78xx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c
index 9385eb0b1ee4..e2925e425f90 100644
--- a/drivers/gpu/drm/bridge/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c
@@ -1303,8 +1303,7 @@ static void unregister_i2c_dummy_clients(struct anx78xx *anx78xx)
 	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(anx78xx->i2c_dummy); i++)
-		if (anx78xx->i2c_dummy[i])
-			i2c_unregister_device(anx78xx->i2c_dummy[i]);
+		i2c_unregister_device(anx78xx->i2c_dummy[i]);
 }
 
 static const struct regmap_config anx78xx_regmap_config = {
-- 
2.14.2

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

* [PATCH v1 07/15] drm/i2c/sil164: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (4 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 06/15] drm/bridge: analogix-anx78xx: " Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 08/15] drm/i2c: tda998x: " Andy Shevchenko
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko, David Airlie, dri-devel

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/i2c/sil164_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
index ecaa58757529..c52d7a3af786 100644
--- a/drivers/gpu/drm/i2c/sil164_drv.c
+++ b/drivers/gpu/drm/i2c/sil164_drv.c
@@ -326,8 +326,7 @@ sil164_encoder_destroy(struct drm_encoder *encoder)
 {
 	struct sil164_priv *priv = to_sil164_priv(encoder);
 
-	if (priv->duallink_slave)
-		i2c_unregister_device(priv->duallink_slave);
+	i2c_unregister_device(priv->duallink_slave);
 
 	kfree(priv);
 	drm_i2c_encoder_destroy(encoder);
-- 
2.14.2

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

* [PATCH v1 08/15] drm/i2c: tda998x: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (5 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 07/15] drm/i2c/sil164: " Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-10-31 17:03   ` Russell King - ARM Linux
  2017-10-31 14:21 ` [PATCH v1 09/15] hwmon: (w83781d) " Andy Shevchenko
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: Andy Shevchenko, Russell King, David Airlie, dri-devel

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Russell King <linux@armlinux.org.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 4d1f45acf2cd..7a349e85f964 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 	/* if encoder_init fails, the encoder slave is never registered,
 	 * so cleanup here:
 	 */
-	if (priv->cec)
-		i2c_unregister_device(priv->cec);
+	i2c_unregister_device(priv->cec);
 	return -ENXIO;
 }
 
-- 
2.14.2

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

* [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (6 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 08/15] drm/i2c: tda998x: " Andy Shevchenko
@ 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
                   ` (6 subsequent siblings)
  14 siblings, 2 replies; 37+ 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] 37+ messages in thread

* [PATCH v1 10/15] hwmon: (w83791d) Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (7 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 09/15] hwmon: (w83781d) " 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
                   ` (5 subsequent siblings)
  14 siblings, 1 reply; 37+ 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] 37+ messages in thread

* [PATCH v1 11/15] hwmon: (w83792d) Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (8 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  14 siblings, 1 reply; 37+ 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] 37+ messages in thread

* [PATCH v1 12/15] hwmon: (w83793) Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (9 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
       [not found] ` <20171031142149.32512-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 37+ 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] 37+ messages in thread

* [PATCH v1 13/15] iio: imu: inv_mpu6050: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
@ 2017-10-31 14:21     ` Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 03/15] i2c: thunderx: " Andy Shevchenko
                       ` (13 subsequent siblings)
  14 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang
  Cc: Andy Shevchenko, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio-u79uwXL29TY76Z2rM5mHXA

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>
Cc: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
Cc: Peter Meerwald-Stadler <pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
index dd6fc6d21f9d..d78a10403bac 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
@@ -196,8 +196,7 @@ void inv_mpu_acpi_delete_mux_client(struct i2c_client *client)
 {
 	struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(&client->dev));
 
-	if (st->mux_client)
-		i2c_unregister_device(st->mux_client);
+	i2c_unregister_device(st->mux_client);
 }
 #else
 
-- 
2.14.2

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

* [PATCH v1 13/15] iio: imu: inv_mpu6050: Remove duplicate NULL check
@ 2017-10-31 14:21     ` Andy Shevchenko
  0 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: Andy Shevchenko, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
index dd6fc6d21f9d..d78a10403bac 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
@@ -196,8 +196,7 @@ void inv_mpu_acpi_delete_mux_client(struct i2c_client *client)
 {
 	struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(&client->dev));
 
-	if (st->mux_client)
-		i2c_unregister_device(st->mux_client);
+	i2c_unregister_device(st->mux_client);
 }
 #else
 
-- 
2.14.2

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

* [PATCH v1 14/15] media: adv7180: Remove duplicate checks
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (11 preceding siblings ...)
       [not found] ` <20171031142149.32512-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-10-31 14:21 ` [PATCH v1 15/15] media: i2c: adv748x: Remove duplicate NULL check Andy Shevchenko
  2017-11-01 23:04 ` [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Wolfram Sang
  14 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: Andy Shevchenko, Lars-Peter Clausen, Mauro Carvalho Chehab, linux-media

Since i2c_unregister_device() became NULL-aware we may remove duplicate checks.

Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/media/i2c/adv7180.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 3df28f2f9b38..c7e2ee7fe8a4 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1366,11 +1366,9 @@ static int adv7180_probe(struct i2c_client *client,
 err_free_ctrl:
 	adv7180_exit_controls(state);
 err_unregister_vpp_client:
-	if (state->chip_info->flags & ADV7180_FLAG_I2P)
-		i2c_unregister_device(state->vpp_client);
+	i2c_unregister_device(state->vpp_client);
 err_unregister_csi_client:
-	if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2)
-		i2c_unregister_device(state->csi_client);
+	i2c_unregister_device(state->csi_client);
 	mutex_destroy(&state->mutex);
 	return ret;
 }
@@ -1388,10 +1386,8 @@ static int adv7180_remove(struct i2c_client *client)
 	media_entity_cleanup(&sd->entity);
 	adv7180_exit_controls(state);
 
-	if (state->chip_info->flags & ADV7180_FLAG_I2P)
-		i2c_unregister_device(state->vpp_client);
-	if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2)
-		i2c_unregister_device(state->csi_client);
+	i2c_unregister_device(state->vpp_client);
+	i2c_unregister_device(state->csi_client);
 
 	adv7180_set_power_pin(state, false);
 
-- 
2.14.2

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

* [PATCH v1 15/15] media: i2c: adv748x: Remove duplicate NULL check
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (12 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 14/15] media: adv7180: Remove duplicate checks Andy Shevchenko
@ 2017-10-31 14:21 ` Andy Shevchenko
  2017-11-03 23:41   ` Kieran Bingham
  2017-11-01 23:04 ` [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Wolfram Sang
  14 siblings, 1 reply; 37+ messages in thread
From: Andy Shevchenko @ 2017-10-31 14:21 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang
  Cc: Andy Shevchenko, Kieran Bingham, Mauro Carvalho Chehab, linux-media

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/media/i2c/adv748x/adv748x-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
index 5ee14f2c2747..10c3d469175c 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -225,10 +225,8 @@ static void adv748x_unregister_clients(struct adv748x_state *state)
 {
 	unsigned int i;
 
-	for (i = 1; i < ARRAY_SIZE(state->i2c_clients); ++i) {
-		if (state->i2c_clients[i])
-			i2c_unregister_device(state->i2c_clients[i]);
-	}
+	for (i = 1; i < ARRAY_SIZE(state->i2c_clients); ++i)
+		i2c_unregister_device(state->i2c_clients[i]);
 }
 
 static int adv748x_initialise_clients(struct adv748x_state *state)
-- 
2.14.2

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

* Re: [PATCH v1 08/15] drm/i2c: tda998x: Remove duplicate NULL check
  2017-10-31 14:21 ` [PATCH v1 08/15] drm/i2c: tda998x: " Andy Shevchenko
@ 2017-10-31 17:03   ` Russell King - ARM Linux
  2018-01-18 15:21     ` Ville Syrjälä
  0 siblings, 1 reply; 37+ messages in thread
From: Russell King - ARM Linux @ 2017-10-31 17:03 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-i2c, Wolfram Sang, David Airlie, dri-devel

On Tue, Oct 31, 2017 at 04:21:42PM +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
> 
> Cc: Russell King <linux@armlinux.org.uk>

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> index 4d1f45acf2cd..7a349e85f964 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
>  	/* if encoder_init fails, the encoder slave is never registered,
>  	 * so cleanup here:
>  	 */
> -	if (priv->cec)
> -		i2c_unregister_device(priv->cec);
> +	i2c_unregister_device(priv->cec);
>  	return -ENXIO;
>  }
>  
> -- 
> 2.14.2
> 

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

* Re: [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check
  2017-10-31 14:21 ` [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check Andy Shevchenko
@ 2017-10-31 17:34   ` Jean Delvare
  2017-11-01 23:04   ` Wolfram Sang
  1 sibling, 0 replies; 37+ messages in thread
From: Jean Delvare @ 2017-10-31 17:34 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-i2c, Wolfram Sang, Jean Delvare

On Tue, 31 Oct 2017 16:21:36 +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
> 
> Cc: Jean Delvare <jdelvare@suse.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/i2c/busses/i2c-taos-evm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c
> index addd90a8cb59..7c7fc01116a1 100644
> --- a/drivers/i2c/busses/i2c-taos-evm.c
> +++ b/drivers/i2c/busses/i2c-taos-evm.c
> @@ -282,8 +282,7 @@ static void taos_disconnect(struct serio *serio)
>  {
>  	struct taos_data *taos = serio_get_drvdata(serio);
>  
> -	if (taos->client)
> -		i2c_unregister_device(taos->client);
> +	i2c_unregister_device(taos->client);
>  	i2c_del_adapter(&taos->adapter);
>  	serio_close(serio);
>  	kfree(taos);

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 37+ 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) " Andy Shevchenko
@ 2017-10-31 18:03   ` Jean Delvare
  2017-11-01 13:19   ` Guenter Roeck
  1 sibling, 0 replies; 37+ 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] 37+ 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; 37+ 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] 37+ 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; 37+ 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] 37+ 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; 37+ 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] 37+ 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) " 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; 37+ 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] 37+ 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; 37+ 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] 37+ messages in thread

* Re: [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware
  2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
                   ` (13 preceding siblings ...)
  2017-10-31 14:21 ` [PATCH v1 15/15] media: i2c: adv748x: Remove duplicate NULL check Andy Shevchenko
@ 2017-11-01 23:04 ` Wolfram Sang
  14 siblings, 0 replies; 37+ messages in thread
From: Wolfram Sang @ 2017-11-01 23:04 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

On Tue, Oct 31, 2017 at 04:21:35PM +0200, Andy Shevchenko wrote:
> It's a common pattern to be NULL-aware when freeing resources.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check
  2017-10-31 14:21 ` [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check Andy Shevchenko
  2017-10-31 17:34   ` Jean Delvare
@ 2017-11-01 23:04   ` Wolfram Sang
  1 sibling, 0 replies; 37+ messages in thread
From: Wolfram Sang @ 2017-11-01 23:04 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-i2c, Jean Delvare

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

On Tue, Oct 31, 2017 at 04:21:36PM +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
> 
> Cc: Jean Delvare <jdelvare@suse.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v1 03/15] i2c: thunderx: Remove duplicate NULL check
  2017-10-31 14:21 ` [PATCH v1 03/15] i2c: thunderx: " Andy Shevchenko
@ 2017-11-01 23:04   ` Wolfram Sang
  0 siblings, 0 replies; 37+ messages in thread
From: Wolfram Sang @ 2017-11-01 23:04 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-i2c, Jan Glauber, David Daney

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

On Tue, Oct 31, 2017 at 04:21:37PM +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
> 
> Cc: Jan Glauber <jglauber@cavium.com>
> Cc: David Daney <david.daney@cavium.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 37+ 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; 37+ 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] 37+ 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; 37+ 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] 37+ messages in thread

* Re: [PATCH v1 15/15] media: i2c: adv748x: Remove duplicate NULL check
  2017-10-31 14:21 ` [PATCH v1 15/15] media: i2c: adv748x: Remove duplicate NULL check Andy Shevchenko
@ 2017-11-03 23:41   ` Kieran Bingham
  0 siblings, 0 replies; 37+ messages in thread
From: Kieran Bingham @ 2017-11-03 23:41 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, Wolfram Sang
  Cc: Mauro Carvalho Chehab, linux-media

Hi Andy,

Thankyou for the patch.

On 31/10/17 14:21, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
> 
> Cc: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
>  drivers/media/i2c/adv748x/adv748x-core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
> index 5ee14f2c2747..10c3d469175c 100644
> --- a/drivers/media/i2c/adv748x/adv748x-core.c
> +++ b/drivers/media/i2c/adv748x/adv748x-core.c
> @@ -225,10 +225,8 @@ static void adv748x_unregister_clients(struct adv748x_state *state)
>  {
>  	unsigned int i;
>  
> -	for (i = 1; i < ARRAY_SIZE(state->i2c_clients); ++i) {
> -		if (state->i2c_clients[i])
> -			i2c_unregister_device(state->i2c_clients[i]);
> -	}
> +	for (i = 1; i < ARRAY_SIZE(state->i2c_clients); ++i)
> +		i2c_unregister_device(state->i2c_clients[i]);
>  }
>  
>  static int adv748x_initialise_clients(struct adv748x_state *state)
> 

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

* Re: [PATCH v1 13/15] iio: imu: inv_mpu6050: Remove duplicate NULL check
  2017-10-31 14:21     ` Andy Shevchenko
  (?)
@ 2017-11-19 16:04     ` Jonathan Cameron
  -1 siblings, 0 replies; 37+ messages in thread
From: Jonathan Cameron @ 2017-11-19 16:04 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-i2c, Wolfram Sang, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio

On Tue, 31 Oct 2017 16:21:47 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
> 
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
> Cc: linux-iio@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied to the togreg branch of iio.git.  Thanks,

Jonathan
> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> index dd6fc6d21f9d..d78a10403bac 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> @@ -196,8 +196,7 @@ void inv_mpu_acpi_delete_mux_client(struct i2c_client *client)
>  {
>  	struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(&client->dev));
>  
> -	if (st->mux_client)
> -		i2c_unregister_device(st->mux_client);
> +	i2c_unregister_device(st->mux_client);
>  }
>  #else
>  

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

* Re: [PATCH v1 05/15] gpio: max732x: Remove duplicate NULL check
  2017-10-31 14:21 ` [PATCH v1 05/15] gpio: max732x: " Andy Shevchenko
@ 2017-11-29 12:26   ` Linus Walleij
  0 siblings, 0 replies; 37+ messages in thread
From: Linus Walleij @ 2017-11-29 12:26 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-i2c, Wolfram Sang, linux-gpio

On Tue, Oct 31, 2017 at 3:21 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

For some reason this was missed since halloween.
Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH v1 08/15] drm/i2c: tda998x: Remove duplicate NULL check
  2017-10-31 17:03   ` Russell King - ARM Linux
@ 2018-01-18 15:21     ` Ville Syrjälä
  2018-01-18 15:27       ` Andy Shevchenko
  0 siblings, 1 reply; 37+ messages in thread
From: Ville Syrjälä @ 2018-01-18 15:21 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Andy Shevchenko, David Airlie, linux-i2c, dri-devel, Wolfram Sang

On Tue, Oct 31, 2017 at 05:03:43PM +0000, Russell King - ARM Linux wrote:
> On Tue, Oct 31, 2017 at 04:21:42PM +0200, Andy Shevchenko wrote:
> > Since i2c_unregister_device() became NULL-aware we may remove duplicate
> > NULL check.
> > 
> > Cc: Russell King <linux@armlinux.org.uk>
> 
> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

commit 7b43dd19c9b1 ("i2c: Make i2c_unregister_device() NULL-aware")
seems to be the thing that makes this possible. So these three
patches lgtm -> pushed to drm-misc-next.

> 
> Thanks.
> 
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> > index 4d1f45acf2cd..7a349e85f964 100644
> > --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> > @@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
> >  	/* if encoder_init fails, the encoder slave is never registered,
> >  	 * so cleanup here:
> >  	 */
> > -	if (priv->cec)
> > -		i2c_unregister_device(priv->cec);
> > +	i2c_unregister_device(priv->cec);
> >  	return -ENXIO;
> >  }
> >  
> > -- 
> > 2.14.2
> > 
> 
> -- 
> RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
> According to speedtest.net: 8.21Mbps down 510kbps up
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC

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

* Re: [PATCH v1 08/15] drm/i2c: tda998x: Remove duplicate NULL check
  2018-01-18 15:21     ` Ville Syrjälä
@ 2018-01-18 15:27       ` Andy Shevchenko
  0 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2018-01-18 15:27 UTC (permalink / raw)
  To: Ville Syrjälä, Russell King - ARM Linux
  Cc: David Airlie, linux-i2c, dri-devel, Wolfram Sang

On Thu, 2018-01-18 at 17:21 +0200, Ville Syrjälä wrote:
> On Tue, Oct 31, 2017 at 05:03:43PM +0000, Russell King - ARM Linux
> wrote:
> > On Tue, Oct 31, 2017 at 04:21:42PM +0200, Andy Shevchenko wrote:
> > > Since i2c_unregister_device() became NULL-aware we may remove
> > > duplicate
> > > NULL check.
> > > 
> > > Cc: Russell King <linux@armlinux.org.uk>
> > 
> > Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
> 
> commit 7b43dd19c9b1 ("i2c: Make i2c_unregister_device() NULL-aware")
> seems to be the thing that makes this possible. So these three
> patches lgtm -> pushed to drm-misc-next.
> 

Thanks, Ville!

> > 
> > Thanks.
> > 
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c
> > > b/drivers/gpu/drm/i2c/tda998x_drv.c
> > > index 4d1f45acf2cd..7a349e85f964 100644
> > > --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> > > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> > > @@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client
> > > *client, struct tda998x_priv *priv)
> > >  	/* if encoder_init fails, the encoder slave is never
> > > registered,
> > >  	 * so cleanup here:
> > >  	 */
> > > -	if (priv->cec)
> > > -		i2c_unregister_device(priv->cec);
> > > +	i2c_unregister_device(priv->cec);
> > >  	return -ENXIO;
> > >  }
> > >  
> > > -- 
> > > 2.14.2
> > > 
> > 
> > -- 
> > RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
> > FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down
> > 630kbps up
> > According to speedtest.net: 8.21Mbps down 510kbps up
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* Re: [PATCH v1 04/15] ipmi_ssif: Remove duplicate NULL check
  2017-10-31 14:21 ` [PATCH v1 04/15] ipmi_ssif: " Andy Shevchenko
@ 2018-01-18 15:29   ` Andy Shevchenko
  2018-01-18 15:41     ` Corey Minyard
  0 siblings, 1 reply; 37+ messages in thread
From: Andy Shevchenko @ 2018-01-18 15:29 UTC (permalink / raw)
  To: linux-i2c, Wolfram Sang; +Cc: Corey Minyard, openipmi-developer

On Tue, 2017-10-31 at 16:21 +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove
> duplicate
> NULL check.

Anyone?

Wolfram, I think if no one picks this soon it's quite safe to push it
through i2c tree.

> Cc: Corey Minyard <minyard@acm.org>
> Cc: openipmi-developer@lists.sourceforge.net
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/char/ipmi/ipmi_ssif.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_ssif.c
> b/drivers/char/ipmi/ipmi_ssif.c
> index 466b3a1c0adf..8d183e182eab 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -2072,8 +2072,7 @@ static int ssif_platform_remove(struct
> platform_device *dev)
>  		return 0;
>  
>  	mutex_lock(&ssif_infos_mutex);
> -	if (addr_info->client)
> -		i2c_unregister_device(addr_info->client);
> +	i2c_unregister_device(addr_info->client);
>  
>  	list_del(&addr_info->link);
>  	kfree(addr_info);

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* Re: [PATCH v1 04/15] ipmi_ssif: Remove duplicate NULL check
  2018-01-18 15:29   ` Andy Shevchenko
@ 2018-01-18 15:41     ` Corey Minyard
  2018-01-18 16:46       ` Andy Shevchenko
  0 siblings, 1 reply; 37+ messages in thread
From: Corey Minyard @ 2018-01-18 15:41 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, Wolfram Sang; +Cc: openipmi-developer

On 01/18/2018 09:29 AM, Andy Shevchenko wrote:
> On Tue, 2017-10-31 at 16:21 +0200, Andy Shevchenko wrote:
>> Since i2c_unregister_device() became NULL-aware we may remove
>> duplicate
>> NULL check.
> Anyone?
>
> Wolfram, I think if no one picks this soon it's quite safe to push it
> through i2c tree.
>

I'll pick this up for the next release.

-corey

>> Cc: Corey Minyard <minyard@acm.org>
>> Cc: openipmi-developer@lists.sourceforge.net
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> ---
>>   drivers/char/ipmi/ipmi_ssif.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/char/ipmi/ipmi_ssif.c
>> b/drivers/char/ipmi/ipmi_ssif.c
>> index 466b3a1c0adf..8d183e182eab 100644
>> --- a/drivers/char/ipmi/ipmi_ssif.c
>> +++ b/drivers/char/ipmi/ipmi_ssif.c
>> @@ -2072,8 +2072,7 @@ static int ssif_platform_remove(struct
>> platform_device *dev)
>>   		return 0;
>>   
>>   	mutex_lock(&ssif_infos_mutex);
>> -	if (addr_info->client)
>> -		i2c_unregister_device(addr_info->client);
>> +	i2c_unregister_device(addr_info->client);
>>   
>>   	list_del(&addr_info->link);
>>   	kfree(addr_info);



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* Re: [PATCH v1 04/15] ipmi_ssif: Remove duplicate NULL check
  2018-01-18 15:41     ` Corey Minyard
@ 2018-01-18 16:46       ` Andy Shevchenko
  0 siblings, 0 replies; 37+ messages in thread
From: Andy Shevchenko @ 2018-01-18 16:46 UTC (permalink / raw)
  To: minyard, linux-i2c, Wolfram Sang; +Cc: openipmi-developer

On Thu, 2018-01-18 at 09:41 -0600, Corey Minyard wrote:
> On 01/18/2018 09:29 AM, Andy Shevchenko wrote:
> > On Tue, 2017-10-31 at 16:21 +0200, Andy Shevchenko wrote:
> > > Since i2c_unregister_device() became NULL-aware we may remove
> > > duplicate
> > > NULL check.
> > 
> > Anyone?
> > 
> > Wolfram, I think if no one picks this soon it's quite safe to push
> > it
> > through i2c tree.
> > 
> 
> I'll pick this up for the next release.

Thanks!

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

end of thread, other threads:[~2018-01-18 16:46 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 14:21 [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check Andy Shevchenko
2017-10-31 17:34   ` Jean Delvare
2017-11-01 23:04   ` Wolfram Sang
2017-10-31 14:21 ` [PATCH v1 03/15] i2c: thunderx: " Andy Shevchenko
2017-11-01 23:04   ` Wolfram Sang
2017-10-31 14:21 ` [PATCH v1 04/15] ipmi_ssif: " Andy Shevchenko
2018-01-18 15:29   ` Andy Shevchenko
2018-01-18 15:41     ` Corey Minyard
2018-01-18 16:46       ` Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 05/15] gpio: max732x: " Andy Shevchenko
2017-11-29 12:26   ` Linus Walleij
2017-10-31 14:21 ` [PATCH v1 06/15] drm/bridge: analogix-anx78xx: " Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 07/15] drm/i2c/sil164: " Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 08/15] drm/i2c: tda998x: " Andy Shevchenko
2017-10-31 17:03   ` Russell King - ARM Linux
2018-01-18 15:21     ` Ville Syrjälä
2018-01-18 15:27       ` Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 09/15] hwmon: (w83781d) " Andy Shevchenko
2017-10-31 18:03   ` Jean Delvare
2017-11-01 13:19   ` Guenter Roeck
2017-11-01 13:26     ` Andy Shevchenko
2017-11-01 23:07       ` Wolfram Sang
2017-11-02 12:23         ` Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 10/15] hwmon: (w83791d) " 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 19:32   ` Jean Delvare
2017-10-31 14:21 ` [PATCH v1 12/15] hwmon: (w83793) " Andy Shevchenko
2017-10-31 19:43   ` Jean Delvare
     [not found] ` <20171031142149.32512-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-10-31 14:21   ` [PATCH v1 13/15] iio: imu: inv_mpu6050: " Andy Shevchenko
2017-10-31 14:21     ` Andy Shevchenko
2017-11-19 16:04     ` Jonathan Cameron
2017-10-31 14:21 ` [PATCH v1 14/15] media: adv7180: Remove duplicate checks Andy Shevchenko
2017-10-31 14:21 ` [PATCH v1 15/15] media: i2c: adv748x: Remove duplicate NULL check Andy Shevchenko
2017-11-03 23:41   ` Kieran Bingham
2017-11-01 23:04 ` [PATCH v1 01/15] i2c: Make i2c_unregister_device() NULL-aware Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.