netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] liquidio: remove unnecessary NULL check before kfree in delete_glists
@ 2017-10-17 18:59 Gustavo A. R. Silva
  2017-10-17 19:01 ` [PATCH 2/2] liquidio: mark expected switch fall-through in octeon_destroy_resources Gustavo A. R. Silva
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-17 18:59 UTC (permalink / raw)
  To: Derek Chickles, Satanand Burla, Felix Manlunas, Raghu Vatsavayi
  Cc: netdev, linux-kernel, Gustavo A. R. Silva

NULL check before freeing functions like kfree is not needed.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
This code was tested by compilation only.

 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index 2e993ce..e4a112c 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -435,8 +435,7 @@ static void delete_glists(struct lio *lio)
 		do {
 			g = (struct octnic_gather *)
 			    list_delete_head(&lio->glist[i]);
-			if (g)
-				kfree(g);
+			kfree(g);
 		} while (g);
 
 		if (lio->glists_virt_base && lio->glists_virt_base[i] &&
-- 
2.7.4

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

end of thread, other threads:[~2017-10-19 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 18:59 [PATCH 1/2] liquidio: remove unnecessary NULL check before kfree in delete_glists Gustavo A. R. Silva
2017-10-17 19:01 ` [PATCH 2/2] liquidio: mark expected switch fall-through in octeon_destroy_resources Gustavo A. R. Silva
2017-10-18 17:53   ` Felix Manlunas
2017-10-19 12:28   ` David Miller
2017-10-18 17:47 ` [PATCH 1/2] liquidio: remove unnecessary NULL check before kfree in delete_glists Felix Manlunas
2017-10-19 12:28 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).