Re: [PATCH v3] tpm: st33zp24: Make st33zp24_remove() a void function

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

 



On Fri, Jan 07, 2022 at 01:44:58PM +0200, Jarkko Sakkinen wrote:
> On Wed, Jan 05, 2022 at 12:11:03AM +0100, Uwe Kleine-König wrote:
> > Up to now st33zp24_remove() returns zero unconditionally. Make it return
> > no value 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.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> 
> This patch does not improve functinality in any possible way, and neither
> does it fix any bug.

There is no bug, but getting rid of

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

in a function that shouldn't return a value != 0 is a good thing. And
given that I want to do

	-static int st33zp24_spi_remove(struct spi_device *dev)
	+static void st33zp24_spi_remove(struct spi_device *dev)
	 {
	 	struct tpm_chip *chip = spi_get_drvdata(dev);

		st33zp24_remove(chip);
	-
	-	return 0
	 }

soon, this is much nicer than

	-static int st33zp24_spi_remove(struct spi_device *dev)
	+static void 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
	+		dev_err(&dev->dev, "Ignoring error ...\n");
	-
	-	return 0;
	 }

Now adding that st33zp24_remove always returns 0, I think this is really
a worthwhile change.

Best regards
Uwe

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

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux