[PATCH 1/1] char: tpm: Deletion of unnecessary checks before the function call "tpm_dev_vendor_relea

SF Markus Elfring
2014-11-19T13:50:44Z

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 19 Nov 2014 14:44:15 +0100

The tpm_dev_vendor_release() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/char/tpm/tpm_i2c_atmel.c | 3 +--
drivers/char/tpm/tpm_i2c_nuvoton.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index 7727292..19c3a7b 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -202,8 +202,7 @@ static int i2c_atmel_remove(struct i2c_client *client)
struct device *dev = &(client->dev);
struct tpm_chip *chip = dev_get_drvdata(dev);

- if (chip)
- tpm_dev_vendor_release(chip);
+ tpm_dev_vendor_release(chip);
tpm_remove_hardware(dev);
kfree(chip);
return 0;
diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index 7b158ef..8d09628 100644
--- a/drivers/char/tpm/tpm_i2c_nuvoton.c
+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
@@ -625,8 +625,7 @@ static int i2c_nuvoton_remove(struct i2c_client *client)
struct device *dev = &(client->dev);
struct tpm_chip *chip = dev_get_drvdata(dev);

- if (chip)
- tpm_dev_vendor_release(chip);
+ tpm_dev_vendor_release(chip);
tpm_remove_hardware(dev);
kfree(chip);
return 0;
--
2.1.3