diff mbox series

[3/3] tpm: st33zp24: remove pointless checks on probe

Message ID 20220926053958.1541912-3-dmitry.torokhov@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/3] tpm: st33zp24: drop support for platform data | expand

Commit Message

Dmitry Torokhov Sept. 26, 2022, 5:39 a.m. UTC
Driver core will never call driver's probe method without appropriate
device structure, so testing them for NULL is pointless.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/char/tpm/st33zp24/i2c.c | 6 ------
 drivers/char/tpm/st33zp24/spi.c | 7 -------
 2 files changed, 13 deletions(-)

Comments

Jarkko Sakkinen Sept. 30, 2022, 8:44 p.m. UTC | #1
On Sun, Sep 25, 2022 at 10:39:58PM -0700, Dmitry Torokhov wrote:
> Driver core will never call driver's probe method without appropriate
> device structure, so testing them for NULL is pointless.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Missing a description what the patch does.

Also instead of "driver's probe method" you could just use
"st33zp24_i2c_probe()". It's even shorter.

BR, Jarkko
Dmitry Torokhov Oct. 1, 2022, 4:13 a.m. UTC | #2
On Fri, Sep 30, 2022 at 11:44:21PM +0300, Jarkko Sakkinen wrote:
> On Sun, Sep 25, 2022 at 10:39:58PM -0700, Dmitry Torokhov wrote:
> > Driver core will never call driver's probe method without appropriate
> > device structure, so testing them for NULL is pointless.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Missing a description what the patch does.
> 
> Also instead of "driver's probe method" you could just use
> "st33zp24_i2c_probe()". It's even shorter.

There are 2 interfaces: I2C and SPI, thus 2 separate probe methods.

Thanks.
diff mbox series

Patch

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)