All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: kpc2000: Remove null check before kfree
@ 2019-07-18 18:22 ` Hariprasad Kelam
  0 siblings, 0 replies; 2+ messages in thread
From: Hariprasad Kelam @ 2019-07-18 18:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Geordan Neukum, Dan Carpenter,
	Michael Scheiderer, Fabian Krueger, Simon Sandström,
	Jeremy Sowden, devel, linux-kernel

As kfree already has NULL check we may not need null check before
calling same.

Issue found with coccicheck

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 35ac1d7..c07d2fc 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -411,9 +411,7 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
 kp_spi_cleanup(struct spi_device *spidev)
 {
 	struct kp_spi_controller_state *cs = spidev->controller_state;
-
-	if (cs)
-		kfree(cs);
+	kfree(cs);
 }
 
 /******************
-- 
2.7.4


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

* [PATCH] staging: kpc2000: Remove null check before kfree
@ 2019-07-18 18:22 ` Hariprasad Kelam
  0 siblings, 0 replies; 2+ messages in thread
From: Hariprasad Kelam @ 2019-07-18 18:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Geordan Neukum, Dan Carpenter,
	Michael Scheiderer, Fabian Krueger, Simon Sandström,
	Jeremy Sowden, devel, linux-kernel

As kfree already has NULL check we may not need null check before
calling same.

Issue found with coccicheck

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 35ac1d7..c07d2fc 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -411,9 +411,7 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
 kp_spi_cleanup(struct spi_device *spidev)
 {
 	struct kp_spi_controller_state *cs = spidev->controller_state;
-
-	if (cs)
-		kfree(cs);
+	kfree(cs);
 }
 
 /******************
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2019-07-18 18:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18 18:22 [PATCH] staging: kpc2000: Remove null check before kfree Hariprasad Kelam
2019-07-18 18:22 ` Hariprasad Kelam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.