public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] char: tpm: Deletion of unnecessary checks before the function call "tpm_dev_vendor_release"
  2014-03-05 22:30                               ` [PATCH with Coccinelle?] Deletion of unnecessary checks before specific function calls SF Markus Elfring
@ 2014-11-19 13:50                                 ` SF Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: SF Markus Elfring @ 2014-11-19 13:50 UTC (permalink / raw)
  To: Ashley Lai, Marcel Selhorst, Peter Huewe, tpmdd-devel
  Cc: LKML, kernel-janitors, Julia Lawall

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


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

* [PATCH 1/1] char: tpm: Deletion of unnecessary checks before the function call "tpm_dev_vendor_release"
@ 2014-11-30 14:22 Peter Hüwe
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Hüwe @ 2014-11-30 14:22 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Ashley Lai, Marcel Selhorst, Peter Huewe, tpmdd-devel, LKML,
	kernel-janitors, Julia Lawall

Applied to my tree:
https://github.com/PeterHuewe/linux-tpmdd for-james

Will be included in the next pull-request.

Thanks,
Peter

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

end of thread, other threads:[~2014-11-30 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-30 14:22 [PATCH 1/1] char: tpm: Deletion of unnecessary checks before the function call "tpm_dev_vendor_release" Peter Hüwe
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
2014-03-05 22:30                               ` [PATCH with Coccinelle?] Deletion of unnecessary checks before specific function calls SF Markus Elfring
2014-11-19 13:50                                 ` [PATCH 1/1] char: tpm: Deletion of unnecessary checks before the function call "tpm_dev_vendor_release" SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox