* [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
[parent not found: <5307CAA2.8060406@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>]
[parent not found: <530A086E.8010901@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>]
[parent not found: <530A72AA.3000601@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>]
[parent not found: <530B5FB6.6010207@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.10.1402241710370.2074@hadrien>]
[parent not found: <530C5E18.1020800@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.10.1402251014170.2080@hadrien>]
[parent not found: <530CD2C4.4050903@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.10.1402251840450.7035@hadrien>]
[parent not found: <530CF8FF.8080600@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>]
[parent not found: <530DD06F.4090703@users.sourceforge.net>]
[parent not found: <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>]
* Re: [PATCH with Coccinelle?] Deletion of unnecessary checks before specific function calls [not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6> @ 2014-03-05 22:30 ` 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 0 siblings, 1 reply; 2+ messages in thread From: SF Markus Elfring @ 2014-03-05 22:30 UTC (permalink / raw) To: linux-kernel; +Cc: Coccinelle, kernel-janitors > If you are convinced that dropping the null tests is a good idea, then you > can submit the patch that makes the change to the relevant maintainers and > mailing lists. Hello, A couple of functions perform input parameter validation before their implementations will try further actions with side effects. Some calling functions perform similar safety checks. Functions which release a system resource are often documented in the way that they tolerate the passing of a null pointer for example. I do not see a need because of this fact that a function caller repeats a corresponding check. Now I would like to propose such a change again. 1. Extension of the infrastructure for the analysis tool "coccicheck" Semantic patch patterns can help to identify update candidates also in the Linux source file hierarchy. https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/scripts/coccinelle?id=79f0345fefaafb7cde301a830471edd21a37989b 2. Clarification for some automated update suggestions My source code search approach found seventy functions at least which might need another review and corresponding corrections for Linux 3.14-rc5. Further software development will point out even more potentially open issues. Regards, Markus ^ permalink raw reply [flat|nested] 2+ messages in thread
* [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
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