Skip to contentSkip to conversation

Make some spi device drivers return zero in .remove()

PATCH Applied Uwe Kleine-König 6 participants 22 messages Oct 11, 2021 – Oct 12, 2021

Subsystems (18)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Make some spi device drivers return zero in .remove()

Hello,

this series is part of my new quest to make spi remove callbacks return void. Today they return an int, but the only result of returning a non-zero value is a warning message. So it's a bad idea to return an error code in the expectation that not freeing some resources is ok then. The same holds true for i2c and platform devices which benefit en passant for a few drivers.

The patches in this series address some of the spi drivers that might return non-zero and adapt them accordingly to return zero instead. For most drivers it's just about not hiding the fact that they already return zero.

Given that there are quite some more patches of this type to create before I can change the spi remove callback, I suggest the respecive subsystem maintainers pick up these patches. There are no interdependencies in this series.

Uwe Kleine-König (13):
drm/panel: s6e63m0: Make s6e63m0_remove() return void
hwmon: adt7x10: Make adt7x10_remove() return void
hwmon: max31722: Warn about failure to put device in stand-by in

    .remove()

input: adxl34xx: Make adxl34x_remove() return void
input: touchscreen: tsc200x: Make tsc200x_remove() return void
media: cxd2880: Eliminate dead code
mfd: mc13xxx: Make mc13xxx_common_exit() return void
mfd: stmpe: Make stmpe_remove() return void
mfd: tps65912: Make tps65912_device_exit() return void
serial: max310x: Make max310x_remove() return void
serial: sc16is7xx: Make sc16is7xx_remove() return void
staging: fbtft: Make fbtft_remove_common() return void
tpm: st33zp24: Make st33zp24_remove() return void

 drivers/char/tpm/st33zp24/i2c.c                   |  5 +----
 drivers/char/tpm/st33zp24/spi.c                   |  5 +----
 drivers/char/tpm/st33zp24/st33zp24.c              |  3 +--
 drivers/char/tpm/st33zp24/st33zp24.h              |  2 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c |  3 ++-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c |  3 ++-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c     |  4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.h     |  2 +-
 drivers/hwmon/adt7310.c                           |  3 ++-
 drivers/hwmon/adt7410.c                           |  3 ++-
 drivers/hwmon/adt7x10.c                           |  3 +--
 drivers/hwmon/adt7x10.h                           |  2 +-
 drivers/hwmon/max31722.c                          |  8 +++++++-
 drivers/input/misc/adxl34x-i2c.c                  |  4 +++-
 drivers/input/misc/adxl34x-spi.c                  |  4 +++-
 drivers/input/misc/adxl34x.c                      |  4 +---
 drivers/input/misc/adxl34x.h                      |  2 +-
 drivers/input/touchscreen/tsc2004.c               |  4 +++-
 drivers/input/touchscreen/tsc2005.c               |  4 +++-
 drivers/input/touchscreen/tsc200x-core.c          |  4 +---
 drivers/input/touchscreen/tsc200x-core.h          |  2 +-
 drivers/media/spi/cxd2880-spi.c                   | 13 +------------
 drivers/mfd/mc13xxx-core.c                        |  4 +---
 drivers/mfd/mc13xxx-i2c.c                         |  3 ++-
 drivers/mfd/mc13xxx-spi.c                         |  3 ++-
 drivers/mfd/mc13xxx.h                             |  2 +-
 drivers/mfd/stmpe-i2c.c                           |  4 +++-
 drivers/mfd/stmpe-spi.c                           |  4 +++-
 drivers/mfd/stmpe.c                               |  4 +---
 drivers/mfd/stmpe.h                               |  2 +-
 drivers/mfd/tps65912-core.c                       |  4 +---
 drivers/mfd/tps65912-i2c.c                        |  4 +++-
 drivers/mfd/tps65912-spi.c                        |  4 +++-
 drivers/staging/fbtft/fbtft-core.c                |  8 +-------
 drivers/staging/fbtft/fbtft.h                     |  6 ++++--
 drivers/tty/serial/max310x.c                      |  7 +++----
 drivers/tty/serial/sc16is7xx.c                    | 10 +++++++---
 include/linux/mfd/tps65912.h                      |  2 +-
 38 files changed, 77 insertions(+), 81 deletions(-)

base-commit: 9e1ff307c779ce1f0f810c7ecce3d95bbae40896

Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/13 drm/panel: s6e63m0: Make s6e63m0_remove() return void

Up to now s6e63m0_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of spi remove callbacks is ignored anyway.

---
 drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 3 ++-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 3 ++-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c     | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.h     | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c +2 -1
index e0b1a7e354f3..e0f773678168 100644
@@ -116,7 +116,8 @@ static int s6e63m0_dsi_probe(struct mipi_dsi_device *dsi)
 static int s6e63m0_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	mipi_dsi_detach(dsi);
-	return s6e63m0_remove(&dsi->dev);
+	s6e63m0_remove(&dsi->dev);
+	return 0;
 }
 
 static const struct of_device_id s6e63m0_dsi_of_match[] = {
drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +2 -1
index 3669cc3719ce..c178d962b0d5 100644
@@ -64,7 +64,8 @@ static int s6e63m0_spi_probe(struct spi_device *spi)
 
 static int s6e63m0_spi_remove(struct spi_device *spi)
 {
-	return s6e63m0_remove(&spi->dev);
+	s6e63m0_remove(&spi->dev);
+	return 0;
 }
 
 static const struct of_device_id s6e63m0_spi_of_match[] = {
drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +1 -3
index 35d72ac663d6..b34fa4d5de07 100644
@@ -749,13 +749,11 @@ int s6e63m0_probe(struct device *dev, void *trsp,
 }
 EXPORT_SYMBOL_GPL(s6e63m0_probe);
 
-int s6e63m0_remove(struct device *dev)
+void s6e63m0_remove(struct device *dev)
 {
 	struct s6e63m0 *ctx = dev_get_drvdata(dev);
 
 	drm_panel_remove(&ctx->panel);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(s6e63m0_remove);
 
drivers/gpu/drm/panel/panel-samsung-s6e63m0.h +1 -1
index 306605ed1117..c926eca1c817 100644
@@ -35,6 +35,6 @@ int s6e63m0_probe(struct device *dev, void *trsp,
 				   const u8 *data,
 				   size_t len),
 		  bool dsi_mode);
-int s6e63m0_remove(struct device *dev);
+void s6e63m0_remove(struct device *dev);
 
 #endif /* _PANEL_SAMSUNG_S6E63M0_H */
Signature · 1 line
2.30.2
Applied
#2 lore raw

Re: [PATCH 01/13] drm/panel: s6e63m0: Make s6e63m0_remove() return void

Hi Uwe,

Quoted 7 lines · Uwe Kleine-König

Up to now s6e63m0_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of spi remove callbacks is ignored anyway.

Thanks, applied to drm-misc-next.

Sam

#3 lore raw

PATCH 2/13 hwmon: adt7x10: Make adt7x10_remove() return void

In reply to Uwe Kleine-König

Up to now adt7x10_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

---
 drivers/hwmon/adt7310.c | 3 ++-
 drivers/hwmon/adt7410.c | 3 ++-
 drivers/hwmon/adt7x10.c | 3 +--
 drivers/hwmon/adt7x10.h | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)
drivers/hwmon/adt7310.c +2 -1
index 9fad01191620..c40cac16af68 100644
@@ -90,7 +90,8 @@ static int adt7310_spi_probe(struct spi_device *spi)
 
 static int adt7310_spi_remove(struct spi_device *spi)
 {
-	return adt7x10_remove(&spi->dev, spi->irq);
+	adt7x10_remove(&spi->dev, spi->irq);
+	return 0;
 }
 
 static const struct spi_device_id adt7310_id[] = {
drivers/hwmon/adt7410.c +2 -1
index 9d80895d0266..973db057427b 100644
@@ -50,7 +50,8 @@ static int adt7410_i2c_probe(struct i2c_client *client)
 
 static int adt7410_i2c_remove(struct i2c_client *client)
 {
-	return adt7x10_remove(&client->dev, client->irq);
+	adt7x10_remove(&client->dev, client->irq);
+	return 0;
 }
 
 static const struct i2c_device_id adt7410_ids[] = {
drivers/hwmon/adt7x10.c +1 -2
index 3f03b4cf5858..e9d33aa78a19 100644
@@ -444,7 +444,7 @@ int adt7x10_probe(struct device *dev, const char *name, int irq,
 }
 EXPORT_SYMBOL_GPL(adt7x10_probe);
 
-int adt7x10_remove(struct device *dev, int irq)
+void adt7x10_remove(struct device *dev, int irq)
 {
 	struct adt7x10_data *data = dev_get_drvdata(dev);
 
@@ -457,7 +457,6 @@ int adt7x10_remove(struct device *dev, int irq)
 	sysfs_remove_group(&dev->kobj, &adt7x10_group);
 	if (data->oldconfig != data->config)
 		adt7x10_write_byte(dev, ADT7X10_CONFIG, data->oldconfig);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(adt7x10_remove);
 
drivers/hwmon/adt7x10.h +1 -1
index 21ad15ce3163..a1ae682eb32e 100644
@@ -26,7 +26,7 @@ struct adt7x10_ops {
 
 int adt7x10_probe(struct device *dev, const char *name, int irq,
 	const struct adt7x10_ops *ops);
-int adt7x10_remove(struct device *dev, int irq);
+void adt7x10_remove(struct device *dev, int irq);
 
 #ifdef CONFIG_PM_SLEEP
 extern const struct dev_pm_ops adt7x10_dev_pm_ops;
Signature · 1 line
2.30.2
maintainer Applied
#4 lore raw

Re: [PATCH 02/13] hwmon: adt7x10: Make adt7x10_remove() return void

Quoted 7 lines · Uwe Kleine-König

Up to now adt7x10_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Applied.

Thanks,
Guenter

Quoted 69 lines
---
 drivers/hwmon/adt7310.c | 3 ++-
 drivers/hwmon/adt7410.c | 3 ++-
 drivers/hwmon/adt7x10.c | 3 +--
 drivers/hwmon/adt7x10.h | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)
drivers/hwmon/adt7310.c +2 -1
index 9fad01191620..c40cac16af68 100644
@@ -90,7 +90,8 @@ static int adt7310_spi_probe(struct spi_device *spi)
 
 static int adt7310_spi_remove(struct spi_device *spi)
 {
-	return adt7x10_remove(&spi->dev, spi->irq);
+	adt7x10_remove(&spi->dev, spi->irq);
+	return 0;
 }
 
 static const struct spi_device_id adt7310_id[] = {
drivers/hwmon/adt7410.c +2 -1
index 9d80895d0266..973db057427b 100644
@@ -50,7 +50,8 @@ static int adt7410_i2c_probe(struct i2c_client *client)
 
 static int adt7410_i2c_remove(struct i2c_client *client)
 {
-	return adt7x10_remove(&client->dev, client->irq);
+	adt7x10_remove(&client->dev, client->irq);
+	return 0;
 }
 
 static const struct i2c_device_id adt7410_ids[] = {
drivers/hwmon/adt7x10.c +1 -2
index 3f03b4cf5858..e9d33aa78a19 100644
@@ -444,7 +444,7 @@ int adt7x10_probe(struct device *dev, const char *name, int irq,
 }
 EXPORT_SYMBOL_GPL(adt7x10_probe);
 
-int adt7x10_remove(struct device *dev, int irq)
+void adt7x10_remove(struct device *dev, int irq)
 {
 	struct adt7x10_data *data = dev_get_drvdata(dev);
 
@@ -457,7 +457,6 @@ int adt7x10_remove(struct device *dev, int irq)
 	sysfs_remove_group(&dev->kobj, &adt7x10_group);
 	if (data->oldconfig != data->config)
 		adt7x10_write_byte(dev, ADT7X10_CONFIG, data->oldconfig);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(adt7x10_remove);
 
drivers/hwmon/adt7x10.h +1 -1
index 21ad15ce3163..a1ae682eb32e 100644
@@ -26,7 +26,7 @@ struct adt7x10_ops {
 
 int adt7x10_probe(struct device *dev, const char *name, int irq,
 	const struct adt7x10_ops *ops);
-int adt7x10_remove(struct device *dev, int irq);
+void adt7x10_remove(struct device *dev, int irq);
 
 #ifdef CONFIG_PM_SLEEP
 extern const struct dev_pm_ops adt7x10_dev_pm_ops;
#5 lore raw

PATCH 3/13 hwmon: max31722: Warn about failure to put device in stand-by in .remove()

In reply to Uwe Kleine-König

When an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.

---
 drivers/hwmon/max31722.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/max31722.c +7 -1
index 613338cbcb17..4cf4fe6809a3 100644
@@ -103,10 +103,16 @@ static int max31722_probe(struct spi_device *spi)
 static int max31722_remove(struct spi_device *spi)
 {
 	struct max31722_data *data = spi_get_drvdata(spi);
+	int ret;
 
 	hwmon_device_unregister(data->hwmon_dev);
 
-	return max31722_set_mode(data, MAX31722_MODE_STANDBY);
+	ret = max31722_set_mode(data, MAX31722_MODE_STANDBY);
+	if (ret)
+		/* There is nothing we can do about this ... */
+		dev_warn(&spi->dev, "Failed to put device in stand-by mode\n");
+
+	return 0;
 }
 
 static int __maybe_unused max31722_suspend(struct device *dev)
Signature · 1 line
2.30.2
maintainer Acked-by on v1 3/13
#6 lore raw

RE: [PATCH 03/13] hwmon: max31722: Warn about failure to put device in stand-by in .remove()

Quoted 12 lines

-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: Montag, 11. Oktober 2021 15:28
To: Dmitry Torokhov <[email protected]>; Hennerich, Michael <[email protected]>
Cc: Mark Brown <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH 03/13] hwmon: max31722: Warn about failure to put device in stand-by in .remove()

Quoted 5 lines

When an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.

Quoted 28 lines
---
 drivers/hwmon/max31722.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/max31722.c index renamed from drivers/hwmon/max31722.c +0 -0

613338cbcb17..4cf4fe6809a3 100644

drivers/hwmon/max31722.c +7 -2
@@ -103,10 +103,16 @@ static int max31722_probe(struct spi_device *spi)
 static int max31722_remove(struct spi_device *spi)  {
 	struct max31722_data *data = spi_get_drvdata(spi);
+	int ret;
 
 	hwmon_device_unregister(data->hwmon_dev);
 
-	return max31722_set_mode(data, MAX31722_MODE_STANDBY);
+	ret = max31722_set_mode(data, MAX31722_MODE_STANDBY);
+	if (ret)
+		/* There is nothing we can do about this ... */
+		dev_warn(&spi->dev, "Failed to put device in stand-by
 mode\n");
+
+	return 0;
 }
 
 static int __maybe_unused max31722_suspend(struct device *dev)
--

2.30.2

#7 lore raw

PATCH 4/13 input: adxl34xx: Make adxl34x_remove() return void

In reply to Uwe Kleine-König

Up to now adxl34x_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

---
 drivers/input/misc/adxl34x-i2c.c | 4 +++-
 drivers/input/misc/adxl34x-spi.c | 4 +++-
 drivers/input/misc/adxl34x.c     | 4 +---
 drivers/input/misc/adxl34x.h     | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/input/misc/adxl34x-i2c.c +3 -1
index e64368a63346..a3b5f88d2bd1 100644
@@ -103,7 +103,9 @@ static int adxl34x_i2c_remove(struct i2c_client *client)
 {
 	struct adxl34x *ac = i2c_get_clientdata(client);
 
-	return adxl34x_remove(ac);
+	adxl34x_remove(ac);
+
+	return 0;
 }
 
 static int __maybe_unused adxl34x_i2c_suspend(struct device *dev)
drivers/input/misc/adxl34x-spi.c +3 -1
index df6afa455e46..6e51c9bc619f 100644
@@ -91,7 +91,9 @@ static int adxl34x_spi_remove(struct spi_device *spi)
 {
 	struct adxl34x *ac = spi_get_drvdata(spi);
 
-	return adxl34x_remove(ac);
+	adxl34x_remove(ac);
+
+	return 0;
 }
 
 static int __maybe_unused adxl34x_spi_suspend(struct device *dev)
drivers/input/misc/adxl34x.c +1 -3
index 4cc4e8ff42b3..34beac80e6f0 100644
@@ -896,15 +896,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 }
 EXPORT_SYMBOL_GPL(adxl34x_probe);
 
-int adxl34x_remove(struct adxl34x *ac)
+void adxl34x_remove(struct adxl34x *ac)
 {
 	sysfs_remove_group(&ac->dev->kobj, &adxl34x_attr_group);
 	free_irq(ac->irq, ac);
 	input_unregister_device(ac->input);
 	dev_dbg(ac->dev, "unregistered accelerometer\n");
 	kfree(ac);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(adxl34x_remove);
 
drivers/input/misc/adxl34x.h +1 -1
index 83a0eeccf613..febf85270fff 100644
@@ -25,6 +25,6 @@ void adxl34x_resume(struct adxl34x *ac);
 struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 			      bool fifo_delay_default,
 			      const struct adxl34x_bus_ops *bops);
-int adxl34x_remove(struct adxl34x *ac);
+void adxl34x_remove(struct adxl34x *ac);
 
 #endif
Signature · 1 line
2.30.2
#8 lore raw

PATCH 5/13 input: touchscreen: tsc200x: Make tsc200x_remove() return void

In reply to Uwe Kleine-König

Up to now tsc200x_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

---
 drivers/input/touchscreen/tsc2004.c      | 4 +++-
 drivers/input/touchscreen/tsc2005.c      | 4 +++-
 drivers/input/touchscreen/tsc200x-core.c | 4 +---
 drivers/input/touchscreen/tsc200x-core.h | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/input/touchscreen/tsc2004.c +3 -1
index 0272cedcc726..9fdd870c4c0b 100644
@@ -45,7 +45,9 @@ static int tsc2004_probe(struct i2c_client *i2c,
 
 static int tsc2004_remove(struct i2c_client *i2c)
 {
-	return tsc200x_remove(&i2c->dev);
+	tsc200x_remove(&i2c->dev);
+
+	return 0;
 }
 
 static const struct i2c_device_id tsc2004_idtable[] = {
drivers/input/touchscreen/tsc2005.c +3 -1
index 923496bbb368..edaa4afbaab4 100644
@@ -66,7 +66,9 @@ static int tsc2005_probe(struct spi_device *spi)
 
 static int tsc2005_remove(struct spi_device *spi)
 {
-	return tsc200x_remove(&spi->dev);
+	tsc200x_remove(&spi->dev);
+
+	return 0
 }
 
 #ifdef CONFIG_OF
drivers/input/touchscreen/tsc200x-core.c +1 -3
index b8d720d52013..27810f6c69f6 100644
@@ -577,15 +577,13 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
 }
 EXPORT_SYMBOL_GPL(tsc200x_probe);
 
-int tsc200x_remove(struct device *dev)
+void tsc200x_remove(struct device *dev)
 {
 	struct tsc200x *ts = dev_get_drvdata(dev);
 
 	sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
 
 	regulator_disable(ts->vio);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(tsc200x_remove);
 
drivers/input/touchscreen/tsc200x-core.h +1 -1
index a43c08ccfd3d..4ded34425b21 100644
@@ -74,6 +74,6 @@ extern const struct dev_pm_ops tsc200x_pm_ops;
 int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
 		  struct regmap *regmap,
 		  int (*tsc200x_cmd)(struct device *dev, u8 cmd));
-int tsc200x_remove(struct device *dev);
+void tsc200x_remove(struct device *dev);
 
 #endif
Signature · 1 line
2.30.2
#9 lore raw

PATCH 6/13 media: cxd2880: Eliminate dead code

In reply to Uwe Kleine-König

An spi remove callback is never called with an spi_device pointer that is NULL. Also it is only called for devices that probed successfully. As cxd2880_spi_probe() always sets driver data, spi_get_drvdata() cannot be NULL.

Also the return value of spi remove callbacks is ignored anyway and not freeing resources in .remove() is a bad idea.

---
 drivers/media/spi/cxd2880-spi.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/media/spi/cxd2880-spi.c +1 -12
index b91a1e845b97..67cacf29a61e 100644
@@ -628,19 +628,8 @@ cxd2880_spi_probe(struct spi_device *spi)
 static int
 cxd2880_spi_remove(struct spi_device *spi)
 {
-	struct cxd2880_dvb_spi *dvb_spi;
+	struct cxd2880_dvb_spi *dvb_spi = spi_get_drvdata(spi);
 
-	if (!spi) {
-		pr_err("invalid arg\n");
-		return -EINVAL;
-	}
-
-	dvb_spi = spi_get_drvdata(spi);
-
-	if (!dvb_spi) {
-		pr_err("failed\n");
-		return -EINVAL;
-	}
 	dvb_spi->demux.dmx.remove_frontend(&dvb_spi->demux.dmx,
 					   &dvb_spi->dmx_fe);
 	dvb_dmxdev_release(&dvb_spi->dmxdev);
Signature · 1 line
2.30.2
#10 lore raw

PATCH 7/13 mfd: mc13xxx: Make mc13xxx_common_exit() return void

In reply to Uwe Kleine-König

Up to now mc13xxx_common_exit() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

---
 drivers/mfd/mc13xxx-core.c | 4 +---
 drivers/mfd/mc13xxx-i2c.c  | 3 ++-
 drivers/mfd/mc13xxx-spi.c  | 3 ++-
 drivers/mfd/mc13xxx.h      | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/mfd/mc13xxx-core.c +1 -3
index 1abe7432aad8..8a4f1d90dcfd 100644
@@ -496,15 +496,13 @@ int mc13xxx_common_init(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(mc13xxx_common_init);
 
-int mc13xxx_common_exit(struct device *dev)
+void mc13xxx_common_exit(struct device *dev)
 {
 	struct mc13xxx *mc13xxx = dev_get_drvdata(dev);
 
 	mfd_remove_devices(dev);
 	regmap_del_irq_chip(mc13xxx->irq, mc13xxx->irq_data);
 	mutex_destroy(&mc13xxx->lock);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(mc13xxx_common_exit);
 
drivers/mfd/mc13xxx-i2c.c +2 -1
index 65b4dd8e5afb..fb937f66277e 100644
@@ -87,7 +87,8 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 
 static int mc13xxx_i2c_remove(struct i2c_client *client)
 {
-	return mc13xxx_common_exit(&client->dev);
+	mc13xxx_common_exit(&client->dev);
+	return 0;
 }
 
 static struct i2c_driver mc13xxx_i2c_driver = {
drivers/mfd/mc13xxx-spi.c +2 -1
index 286ddcf5ddc6..f60227723b4a 100644
@@ -168,7 +168,8 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 
 static int mc13xxx_spi_remove(struct spi_device *spi)
 {
-	return mc13xxx_common_exit(&spi->dev);
+	mc13xxx_common_exit(&spi->dev);
+	return 0
 }
 
 static struct spi_driver mc13xxx_spi_driver = {
drivers/mfd/mc13xxx.h +1 -1
index ce6eec52e8eb..bd5ba9a0e14f 100644
@@ -44,6 +44,6 @@ struct mc13xxx {
 };
 
 int mc13xxx_common_init(struct device *dev);
-int mc13xxx_common_exit(struct device *dev);
+void mc13xxx_common_exit(struct device *dev);
 
 #endif /* __DRIVERS_MFD_MC13XXX_H */
Signature · 1 line
2.30.2
#11 lore raw

PATCH 8/13 mfd: stmpe: Make stmpe_remove() return void

In reply to Uwe Kleine-König

Up to now stmpe_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

---
 drivers/mfd/stmpe-i2c.c | 4 +++-
 drivers/mfd/stmpe-spi.c | 4 +++-
 drivers/mfd/stmpe.c     | 4 +---
 drivers/mfd/stmpe.h     | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/stmpe-i2c.c +3 -1
index cd2f45257dc1..d3eedf3d607e 100644
@@ -95,7 +95,9 @@ static int stmpe_i2c_remove(struct i2c_client *i2c)
 {
 	struct stmpe *stmpe = dev_get_drvdata(&i2c->dev);
 
-	return stmpe_remove(stmpe);
+	stmpe_remove(stmpe);
+
+	return 0;
 }
 
 static const struct i2c_device_id stmpe_i2c_id[] = {
drivers/mfd/stmpe-spi.c +3 -1
index 7351734f7593..6c5915016be5 100644
@@ -106,7 +106,9 @@ static int stmpe_spi_remove(struct spi_device *spi)
 {
 	struct stmpe *stmpe = spi_get_drvdata(spi);
 
-	return stmpe_remove(stmpe);
+	stmpe_remove(stmpe);
+
+	return 0;
 }
 
 static const struct of_device_id stmpe_spi_of_match[] = {
drivers/mfd/stmpe.c +1 -3
index 58d09c615e67..e928df95e316 100644
@@ -1496,7 +1496,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
 	return ret;
 }
 
-int stmpe_remove(struct stmpe *stmpe)
+void stmpe_remove(struct stmpe *stmpe)
 {
 	if (!IS_ERR(stmpe->vio))
 		regulator_disable(stmpe->vio);
@@ -1506,8 +1506,6 @@ int stmpe_remove(struct stmpe *stmpe)
 	__stmpe_disable(stmpe, STMPE_BLOCK_ADC);
 
 	mfd_remove_devices(stmpe->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
drivers/mfd/stmpe.h +1 -1
index 83491e99ba3c..1b4f91d03bbf 100644
@@ -98,7 +98,7 @@ struct stmpe_client_info {
 };
 
 int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum);
-int stmpe_remove(struct stmpe *stmpe);
+void stmpe_remove(struct stmpe *stmpe);
 
 #define STMPE_ICR_LSB_HIGH	(1 << 2)
 #define STMPE_ICR_LSB_EDGE	(1 << 1)
Signature · 1 line
2.30.2
#12 lore raw

PATCH 9/13 mfd: tps65912: Make tps65912_device_exit() return void

In reply to Uwe Kleine-König

Up to now tps65912_device_exit() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

---
 drivers/mfd/tps65912-core.c  | 4 +---
 drivers/mfd/tps65912-i2c.c   | 4 +++-
 drivers/mfd/tps65912-spi.c   | 4 +++-
 include/linux/mfd/tps65912.h | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/tps65912-core.c +1 -3
index b55b1d5d6955..c282a05e7146 100644
@@ -115,11 +115,9 @@ int tps65912_device_init(struct tps65912 *tps)
 }
 EXPORT_SYMBOL_GPL(tps65912_device_init);
 
-int tps65912_device_exit(struct tps65912 *tps)
+void tps65912_device_exit(struct tps65912 *tps)
 {
 	regmap_del_irq_chip(tps->irq, tps->irq_data);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(tps65912_device_exit);
 
drivers/mfd/tps65912-i2c.c +3 -1
index f7c22ea7b36c..06eb2784d322 100644
@@ -55,7 +55,9 @@ static int tps65912_i2c_remove(struct i2c_client *client)
 {
 	struct tps65912 *tps = i2c_get_clientdata(client);
 
-	return tps65912_device_exit(tps);
+	tps65912_device_exit(tps);
+
+	return 0;
 }
 
 static const struct i2c_device_id tps65912_i2c_id_table[] = {
drivers/mfd/tps65912-spi.c +3 -1
index 21a8d6ac5c4a..d701926aa46e 100644
@@ -54,7 +54,9 @@ static int tps65912_spi_remove(struct spi_device *spi)
 {
 	struct tps65912 *tps = spi_get_drvdata(spi);
 
-	return tps65912_device_exit(tps);
+	tps65912_device_exit(tps);
+
+	return 0;
 }
 
 static const struct spi_device_id tps65912_spi_id_table[] = {
include/linux/mfd/tps65912.h +1 -1
index 7943e413deae..8a61386cb8c1 100644
@@ -322,6 +322,6 @@ struct tps65912 {
 extern const struct regmap_config tps65912_regmap_config;
 
 int tps65912_device_init(struct tps65912 *tps);
-int tps65912_device_exit(struct tps65912 *tps);
+void tps65912_device_exit(struct tps65912 *tps);
 
 #endif /*  __LINUX_MFD_TPS65912_H */
Signature · 1 line
2.30.2
#13 lore raw

PATCH 10/13 serial: max310x: Make max310x_remove() return void

In reply to Uwe Kleine-König

Up to now max310x_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of spi remove callbacks is ignored anyway.

---
 drivers/tty/serial/max310x.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/tty/serial/max310x.c +3 -4
index 3df0788ddeb0..6816eeb1ffef 100644
@@ -1426,7 +1426,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
 	return ret;
 }
 
-static int max310x_remove(struct device *dev)
+static void max310x_remove(struct device *dev)
 {
 	struct max310x_port *s = dev_get_drvdata(dev);
 	int i;
@@ -1441,8 +1441,6 @@ static int max310x_remove(struct device *dev)
 	}
 
 	clk_disable_unprepare(s->clk);
-
-	return 0;
 }
 
 static const struct of_device_id __maybe_unused max310x_dt_ids[] = {
@@ -1491,7 +1489,8 @@ static int max310x_spi_probe(struct spi_device *spi)
 
 static int max310x_spi_remove(struct spi_device *spi)
 {
-	return max310x_remove(&spi->dev);
+	max310x_remove(&spi->dev);
+	return 0
 }
 
 static const struct spi_device_id max310x_id_table[] = {
Signature · 1 line
2.30.2
#14 lore raw

Re: [PATCH 10/13] serial: max310x: Make max310x_remove() return void

Quoted 34 lines · Uwe Kleine-König

Up to now max310x_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of spi remove callbacks is ignored anyway.

---
 drivers/tty/serial/max310x.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/tty/serial/max310x.c +1 -3
index 3df0788ddeb0..6816eeb1ffef 100644
@@ -1426,7 +1426,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
 	return ret;
 }
 
-static int max310x_remove(struct device *dev)
+static void max310x_remove(struct device *dev)
 {
 	struct max310x_port *s = dev_get_drvdata(dev);
 	int i;
@@ -1441,8 +1441,6 @@ static int max310x_remove(struct device *dev)
 	}
 
 	clk_disable_unprepare(s->clk);
-
-	return 0;
 }
 
 static const struct of_device_id __maybe_unused max310x_dt_ids[] = {

drivers/tty/serial/max310x.c static int max310x_spi_probe(struct spi_device *spi) · line 1493

Quoted 6 lines
drivers/tty/serial/max310x.c +2 -1
@@ -1491,7 +1489,8 @@ static int max310x_spi_probe(struct spi_device *spi)
 
 static int max310x_spi_remove(struct spi_device *spi)
 {
-	return max310x_remove(&spi->dev);
+	max310x_remove(&spi->dev);
+	return 0

Does this compile?

#15 lore raw

PATCH 11/13 serial: sc16is7xx: Make sc16is7xx_remove() return void

In reply to Uwe Kleine-König

Up to now sc16is7xx_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of spi remove callbacks is ignored anyway.

---
 drivers/tty/serial/sc16is7xx.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/tty/serial/sc16is7xx.c +7 -3
index acbb615dd28f..f8cbe451107b 100644
@@ -1365,7 +1365,7 @@ static int sc16is7xx_probe(struct device *dev,
 	return ret;
 }
 
-static int sc16is7xx_remove(struct device *dev)
+static void sc16is7xx_remove(struct device *dev)
 {
 	struct sc16is7xx_port *s = dev_get_drvdata(dev);
 	int i;
@@ -1444,7 +1444,9 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
 
 static int sc16is7xx_spi_remove(struct spi_device *spi)
 {
-	return sc16is7xx_remove(&spi->dev);
+	sc16is7xx_remove(&spi->dev);
+
+	return 0;
 }
 
 static const struct spi_device_id sc16is7xx_spi_id_table[] = {
@@ -1497,7 +1499,9 @@ static int sc16is7xx_i2c_probe(struct i2c_client *i2c,
 
 static int sc16is7xx_i2c_remove(struct i2c_client *client)
 {
-	return sc16is7xx_remove(&client->dev);
+	sc16is7xx_remove(&client->dev);
+
+	return 0;
 }
 
 static const struct i2c_device_id sc16is7xx_i2c_id_table[] = {
Signature · 1 line
2.30.2
#16 lore raw

PATCH 12/13 staging: fbtft: Make fbtft_remove_common() return void

In reply to Uwe Kleine-König

fbtft_remove_common() is only called with a non-NULL fb_info. (All callers are in remove callbacks and the matching probe callbacks set driver data accordingly.) So fbtft_remove_common() always returns zero. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of platform and spi remove callbacks is ignored anyway and not freeing resources in .remove() is a bad idea.

---
 drivers/staging/fbtft/fbtft-core.c | 8 +-------
 drivers/staging/fbtft/fbtft.h      | 6 ++++--
 2 files changed, 5 insertions(+), 9 deletions(-)
drivers/staging/fbtft/fbtft-core.c +1 -7
index ed992ca605eb..9c9eab1182a6 100644
@@ -1318,23 +1318,17 @@ EXPORT_SYMBOL(fbtft_probe_common);
  * @info: Framebuffer
  *
  * Unregisters and releases the framebuffer
- *
- * Return: 0 if successful, negative if error
  */
-int fbtft_remove_common(struct device *dev, struct fb_info *info)
+void fbtft_remove_common(struct device *dev, struct fb_info *info)
 {
 	struct fbtft_par *par;
 
-	if (!info)
-		return -EINVAL;
 	par = info->par;
 	if (par)
 		fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par,
 			      "%s()\n", __func__);
 	fbtft_unregister_framebuffer(info);
 	fbtft_framebuffer_release(info);
-
-	return 0;
 }
 EXPORT_SYMBOL(fbtft_remove_common);
 
drivers/staging/fbtft/fbtft.h +4 -2
index 76f8c090a837..68eba6c71b0f 100644
@@ -283,7 +283,8 @@ static int fbtft_driver_remove_spi(struct spi_device *spi)                 \
 {                                                                          \
 	struct fb_info *info = spi_get_drvdata(spi);                       \
 									   \
-	return fbtft_remove_common(&spi->dev, info);                       \
+	fbtft_remove_common(&spi->dev, info);                              \
+	return 0;                                                          \
 }                                                                          \
 									   \
 static int fbtft_driver_probe_pdev(struct platform_device *pdev)           \
@@ -295,7 +296,8 @@ static int fbtft_driver_remove_pdev(struct platform_device *pdev)          \
 {                                                                          \
 	struct fb_info *info = platform_get_drvdata(pdev);                 \
 									   \
-	return fbtft_remove_common(&pdev->dev, info);                      \
+	fbtft_remove_common(&pdev->dev, info);                             \
+	return 0;                                                          \
 }                                                                          \
 									   \
 static const struct of_device_id dt_ids[] = {                              \
Signature · 1 line
2.30.2
#17 lore raw

PATCH 13/13 tpm: st33zp24: Make st33zp24_remove() return void

In reply to Uwe Kleine-König

Up to now st33zp24_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

---
 drivers/char/tpm/st33zp24/i2c.c      | 5 +----
 drivers/char/tpm/st33zp24/spi.c      | 5 +----
 drivers/char/tpm/st33zp24/st33zp24.c | 3 +--
 drivers/char/tpm/st33zp24/st33zp24.h | 2 +-
 4 files changed, 4 insertions(+), 11 deletions(-)
drivers/char/tpm/st33zp24/i2c.c +1 -4
index 7c617edff4ca..3170d59d660c 100644
@@ -267,11 +267,8 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
 static int st33zp24_i2c_remove(struct i2c_client *client)
 {
 	struct tpm_chip *chip = i2c_get_clientdata(client);
-	int ret;
 
-	ret = st33zp24_remove(chip);
-	if (ret)
-		return ret;
+	st33zp24_remove(chip);
 
 	return 0;
 }
drivers/char/tpm/st33zp24/spi.c +1 -4
index a75dafd39445..ccd9e42b8eab 100644
@@ -384,11 +384,8 @@ static int st33zp24_spi_probe(struct spi_device *dev)
 static int st33zp24_spi_remove(struct spi_device *dev)
 {
 	struct tpm_chip *chip = spi_get_drvdata(dev);
-	int ret;
 
-	ret = st33zp24_remove(chip);
-	if (ret)
-		return ret;
+	st33zp24_remove(chip);
 
 	return 0;
 }
drivers/char/tpm/st33zp24/st33zp24.c +1 -2
index 4ec10ab5e576..2b63654c38d6 100644
@@ -588,10 +588,9 @@ EXPORT_SYMBOL(st33zp24_probe);
  * @param: tpm_data, the tpm phy.
  * @return: 0 in case of success.
  */
-int st33zp24_remove(struct tpm_chip *chip)
+void st33zp24_remove(struct tpm_chip *chip)
 {
 	tpm_chip_unregister(chip);
-	return 0;
 }
 EXPORT_SYMBOL(st33zp24_remove);
 
drivers/char/tpm/st33zp24/st33zp24.h +1 -1
index 6747be1e2502..b387a476c555 100644
@@ -34,5 +34,5 @@ int st33zp24_pm_resume(struct device *dev);
 
 int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops,
 		   struct device *dev, int irq, int io_lpcpd);
-int st33zp24_remove(struct tpm_chip *chip);
+void st33zp24_remove(struct tpm_chip *chip);
 #endif /* __LOCAL_ST33ZP24_H__ */
Signature · 1 line
2.30.2
maintainer
#18 lore raw

Re: [PATCH 13/13] tpm: st33zp24: Make st33zp24_remove() return void

Quoted 3 lines · Uwe Kleine-König

Up to now st33zp24_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

So, void is not a return value.

Quoted 2 lines

Also the return value of i2c and spi remove callbacks is ignored anyway.

                           ~~~     ~~~
			   I2C     SPI
Quoted 69 lines

---
 drivers/char/tpm/st33zp24/i2c.c      | 5 +----
 drivers/char/tpm/st33zp24/spi.c      | 5 +----
 drivers/char/tpm/st33zp24/st33zp24.c | 3 +--
 drivers/char/tpm/st33zp24/st33zp24.h | 2 +-

 4 files changed, 4 insertions(+), 11 deletions(-)
drivers/char/tpm/st33zp24/i2c.c +0 -1
index 7c617edff4ca..3170d59d660c 100644
@@ -267,11 +267,8 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
  static int st33zp24_i2c_remove(struct i2c_client *client)
  {
         struct tpm_chip *chip = i2c_get_clientdata(client);
-       int ret;


-       ret = st33zp24_remove(chip);
-       if (ret)
-               return ret;
+       st33zp24_remove(chip);

        return 0;
 }

drivers/char/tpm/st33zp24/spi.c +0 -1
index a75dafd39445..ccd9e42b8eab 100644
@@ -384,11 +384,8 @@ static int st33zp24_spi_probe(struct spi_device *dev)
  static int st33zp24_spi_remove(struct spi_device *dev)
  {
         struct tpm_chip *chip = spi_get_drvdata(dev);
-       int ret;


-       ret = st33zp24_remove(chip);
-       if (ret)
-               return ret;
+       st33zp24_remove(chip);

        return 0;
 }

drivers/char/tpm/st33zp24/st33zp24.c +1 -2
index 4ec10ab5e576..2b63654c38d6 100644
@@ -588,10 +588,9 @@ EXPORT_SYMBOL(st33zp24_probe);
   * @param: tpm_data, the tpm phy.
   * @return: 0 in case of success.
   */
-int st33zp24_remove(struct tpm_chip *chip)
+void st33zp24_remove(struct tpm_chip *chip)
  {
         tpm_chip_unregister(chip);
-       return 0;
  }
  EXPORT_SYMBOL(st33zp24_remove);

drivers/char/tpm/st33zp24/st33zp24.h +0 -0
index 6747be1e2502..b387a476c555 100644
@@ -34,5 +34,5 @@ int st33zp24_pm_resume(struct device *dev);


 int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops, struct device *dev, int irq, int io_lpcpd);

drivers/char/tpm/st33zp24/st33zp24.h +1 -1
-int st33zp24_remove(struct tpm_chip *chip);
+void st33zp24_remove(struct tpm_chip *chip);
Quoted 1 line

 #endif /* __LOCAL_ST33ZP24_H__ */

Even though this does not improve things at run-time, this does help to understand what the code does, so in that sense I do think that this a sane change to make.

With an appropriate commit message, this can be applied.

/Jarkko

#19 lore raw

Re: [PATCH 13/13] tpm: st33zp24: Make st33zp24_remove() return void

Quoted 6 lines · Jarkko Sakkinen
Quoted 3 lines · Uwe Kleine-König

Up to now st33zp24_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

So, void is not a return value.

Hmm, would you be more happy with "Make it return no value"? I think this is less understandable than "Make it return void". Do you have a constructive suggestion how to formulate.

Quoted 3 lines
Quoted 1 line

Also the return value of i2c and spi remove callbacks is ignored anyway.

                           ~~~     ~~~
			   I2C     SPI

I don't agree. "I2C" is fine if you mean the protocol. For the framework names I consider the small letters better, as it matches the directory name below drivers/ and also matches the function name prefix and what is usually used for short log prefixes. Ditto for spi.

Quoted 64 lines
Quoted 64 lines

---
 drivers/char/tpm/st33zp24/i2c.c      | 5 +----
 drivers/char/tpm/st33zp24/spi.c      | 5 +----
 drivers/char/tpm/st33zp24/st33zp24.c | 3 +--
 drivers/char/tpm/st33zp24/st33zp24.h | 2 +-

 4 files changed, 4 insertions(+), 11 deletions(-)
drivers/char/tpm/st33zp24/i2c.c +0 -1
index 7c617edff4ca..3170d59d660c 100644
@@ -267,11 +267,8 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
  static int st33zp24_i2c_remove(struct i2c_client *client)
  {
         struct tpm_chip *chip = i2c_get_clientdata(client);
-       int ret;


-       ret = st33zp24_remove(chip);
-       if (ret)
-               return ret;
+       st33zp24_remove(chip);

        return 0;
 }

drivers/char/tpm/st33zp24/spi.c +0 -1
index a75dafd39445..ccd9e42b8eab 100644
@@ -384,11 +384,8 @@ static int st33zp24_spi_probe(struct spi_device *dev)
  static int st33zp24_spi_remove(struct spi_device *dev)
  {
         struct tpm_chip *chip = spi_get_drvdata(dev);
-       int ret;


-       ret = st33zp24_remove(chip);
-       if (ret)
-               return ret;
+       st33zp24_remove(chip);

        return 0;
 }

drivers/char/tpm/st33zp24/st33zp24.c +1 -2
index 4ec10ab5e576..2b63654c38d6 100644
@@ -588,10 +588,9 @@ EXPORT_SYMBOL(st33zp24_probe);
   * @param: tpm_data, the tpm phy.
   * @return: 0 in case of success.
   */
-int st33zp24_remove(struct tpm_chip *chip)
+void st33zp24_remove(struct tpm_chip *chip)
  {
         tpm_chip_unregister(chip);
-       return 0;
  }
  EXPORT_SYMBOL(st33zp24_remove);

drivers/char/tpm/st33zp24/st33zp24.h +0 -0
index 6747be1e2502..b387a476c555 100644
@@ -34,5 +34,5 @@ int st33zp24_pm_resume(struct device *dev);

Quoted 8 lines
Quoted 5 lines

 int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops, struct device *dev, int irq, int io_lpcpd);

drivers/char/tpm/st33zp24/st33zp24.h +1 -1
-int st33zp24_remove(struct tpm_chip *chip);
+void st33zp24_remove(struct tpm_chip *chip);

 #endif /* __LOCAL_ST33ZP24_H__ */

Even though this does not improve things at run-time, this does help to understand what the code does,

That is for focus for now. As written in the cover letter the long term goal is to make struct spi_driver::remove return void, too.

Quoted 2 lines

so in that sense I do
think that this a sane change to make.

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
maintainer
#20 lore raw

Re: [PATCH 13/13] tpm: st33zp24: Make st33zp24_remove() return void

Quoted 11 lines · Uwe Kleine-König
Quoted 6 lines · Jarkko Sakkinen
Quoted 3 lines · Uwe Kleine-König

Up to now st33zp24_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle.

So, void is not a return value.

Hmm, would you be more happy with "Make it return no value"? I think this is less understandable than "Make it return void". Do you have a constructive suggestion how to formulate.

I think it is semantically more correct to say that it does not return any value, given that it does not do that :-) You can just state e.g. "Make st33zp24_remove() a void function.", it is semantically sound and not really that confusing.

/Jarkko

#21 lore raw
In reply to Uwe Kleine-König

Hello,

Quoted 22 lines · Uwe Kleine-König

this series is part of my new quest to make spi remove callbacks return void. Today they return an int, but the only result of returning a non-zero value is a warning message. So it's a bad idea to return an error code in the expectation that not freeing some resources is ok then. The same holds true for i2c and platform devices which benefit en passant for a few drivers.

The patches in this series address some of the spi drivers that might return non-zero and adapt them accordingly to return zero instead. For most drivers it's just about not hiding the fact that they already return zero.

Given that there are quite some more patches of this type to create before I can change the spi remove callback, I suggest the respecive subsystem maintainers pick up these patches. There are no interdependencies in this series.

Uwe Kleine-König (13):
drm/panel: s6e63m0: Make s6e63m0_remove() return void
hwmon: adt7x10: Make adt7x10_remove() return void
hwmon: max31722: Warn about failure to put device in stand-by in

    .remove()
Quoted 10 lines

input: adxl34xx: Make adxl34x_remove() return void
input: touchscreen: tsc200x: Make tsc200x_remove() return void
media: cxd2880: Eliminate dead code
mfd: mc13xxx: Make mc13xxx_common_exit() return void
mfd: stmpe: Make stmpe_remove() return void
mfd: tps65912: Make tps65912_device_exit() return void
serial: max310x: Make max310x_remove() return void
serial: sc16is7xx: Make sc16is7xx_remove() return void
staging: fbtft: Make fbtft_remove_common() return void
tpm: st33zp24: Make st33zp24_remove() return void

I thought I would be a good enough programmer to not need build tests. Obviously I was wrong and introduced build problems with the following patches:

	input: touchscreen: tsc200x: Make tsc200x_remove() return void
	mfd: mc13xxx: Make mc13xxx_common_exit() return void
	serial: max310x: Make max310x_remove() return void
	serial: sc16is7xx: Make sc16is7xx_remove() return void

Please don't apply these (unless you also fix the trivial problems in them). I will prepare a v2 soon.

Best regards and sorry for the inconvenience,
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |