linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH v3] tpm: st33zp24: remove pointless checks on probe
@ 2022-12-07  1:44 Dmitry Torokhov
  2022-12-08 10:55 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2022-12-07  1:44 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen
  Cc: Jason Gunthorpe, linux-integrity, linux-kernel

Remove tests for SPI device or I2C client to be non-NULL because
driver core will never call driver's probe method without having
a valid device structure.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

v3: no changes
v2: reworked commit message

This was a part of a 3-patch series, the first 2 dealt with dropping
support for platform data and converting the driver to gpiod API, and
were applied, this one got reviewed-by from Jarkko but for some reason
was left out.

 drivers/char/tpm/st33zp24/i2c.c | 6 ------
 drivers/char/tpm/st33zp24/spi.c | 7 -------
 2 files changed, 13 deletions(-)

diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c
index 614c7d8ed84f..8156bb2af78c 100644
--- a/drivers/char/tpm/st33zp24/i2c.c
+++ b/drivers/char/tpm/st33zp24/i2c.c
@@ -106,12 +106,6 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
 {
 	struct st33zp24_i2c_phy *phy;
 
-	if (!client) {
-		pr_info("%s: i2c client is NULL. Device not accessible.\n",
-			__func__);
-		return -ENODEV;
-	}
-
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		dev_info(&client->dev, "client not i2c capable\n");
 		return -ENODEV;
diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c
index ff4adbe104cf..2154059f0235 100644
--- a/drivers/char/tpm/st33zp24/spi.c
+++ b/drivers/char/tpm/st33zp24/spi.c
@@ -223,13 +223,6 @@ static int st33zp24_spi_probe(struct spi_device *dev)
 {
 	struct st33zp24_spi_phy *phy;
 
-	/* Check SPI platform functionnalities */
-	if (!dev) {
-		pr_info("%s: dev is NULL. Device is not accessible.\n",
-			__func__);
-		return -ENODEV;
-	}
-
 	phy = devm_kzalloc(&dev->dev, sizeof(struct st33zp24_spi_phy),
 			   GFP_KERNEL);
 	if (!phy)
-- 
2.39.0.rc0.267.gcb52ba06e7-goog


-- 
Dmitry

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

* Re: [RESEND PATCH v3] tpm: st33zp24: remove pointless checks on probe
  2022-12-07  1:44 [RESEND PATCH v3] tpm: st33zp24: remove pointless checks on probe Dmitry Torokhov
@ 2022-12-08 10:55 ` Jarkko Sakkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2022-12-08 10:55 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, linux-kernel

On Tue, Dec 06, 2022 at 05:44:57PM -0800, Dmitry Torokhov wrote:
> Remove tests for SPI device or I2C client to be non-NULL because
> driver core will never call driver's probe method without having
> a valid device structure.
> 
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> 
> v3: no changes
> v2: reworked commit message
> 
> This was a part of a 3-patch series, the first 2 dealt with dropping
> support for platform data and converting the driver to gpiod API, and
> were applied, this one got reviewed-by from Jarkko but for some reason
> was left out.
> 
>  drivers/char/tpm/st33zp24/i2c.c | 6 ------
>  drivers/char/tpm/st33zp24/spi.c | 7 -------
>  2 files changed, 13 deletions(-)
> 
> diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c
> index 614c7d8ed84f..8156bb2af78c 100644
> --- a/drivers/char/tpm/st33zp24/i2c.c
> +++ b/drivers/char/tpm/st33zp24/i2c.c
> @@ -106,12 +106,6 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
>  {
>  	struct st33zp24_i2c_phy *phy;
>  
> -	if (!client) {
> -		pr_info("%s: i2c client is NULL. Device not accessible.\n",
> -			__func__);
> -		return -ENODEV;
> -	}
> -
>  	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
>  		dev_info(&client->dev, "client not i2c capable\n");
>  		return -ENODEV;
> diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c
> index ff4adbe104cf..2154059f0235 100644
> --- a/drivers/char/tpm/st33zp24/spi.c
> +++ b/drivers/char/tpm/st33zp24/spi.c
> @@ -223,13 +223,6 @@ static int st33zp24_spi_probe(struct spi_device *dev)
>  {
>  	struct st33zp24_spi_phy *phy;
>  
> -	/* Check SPI platform functionnalities */
> -	if (!dev) {
> -		pr_info("%s: dev is NULL. Device is not accessible.\n",
> -			__func__);
> -		return -ENODEV;
> -	}
> -
>  	phy = devm_kzalloc(&dev->dev, sizeof(struct st33zp24_spi_phy),
>  			   GFP_KERNEL);
>  	if (!phy)
> -- 
> 2.39.0.rc0.267.gcb52ba06e7-goog
> 
> 
> -- 
> Dmitry

Thanks, applied.

BR, Jarkko

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

end of thread, other threads:[~2022-12-08 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07  1:44 [RESEND PATCH v3] tpm: st33zp24: remove pointless checks on probe Dmitry Torokhov
2022-12-08 10:55 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).