* [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
* [PATCH 2/2] liquidio: mark expected switch fall-through in octeon_destroy_resources
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 ` 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
2 siblings, 2 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-17 19:01 UTC (permalink / raw)
To: Derek Chickles, Satanand Burla, Felix Manlunas, Raghu Vatsavayi
Cc: netdev, linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
This code was tested by compilation only (GCC 7.2.0 was used).
Please, verify if the actual intention of the code is to fall through.
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index e4a112c..4c3b568 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -747,7 +747,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
if (lio_wait_for_oq_pkts(oct))
dev_err(&oct->pci_dev->dev, "OQ had pending packets\n");
-
+ /* fall through */
case OCT_DEV_INTR_SET_DONE:
/* Disable interrupts */
oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] liquidio: remove unnecessary NULL check before kfree in delete_glists
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:47 ` Felix Manlunas
2017-10-19 12:28 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: Felix Manlunas @ 2017-10-18 17:47 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Derek Chickles, Satanand Burla, Felix Manlunas, Raghu Vatsavayi,
netdev, linux-kernel
On Tue, Oct 17, 2017 at 01:59:20PM -0500, Gustavo A. R. Silva wrote:
> 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
>
Acked-by: Felix Manlunas <felix.manlunas@cavium.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] liquidio: mark expected switch fall-through in octeon_destroy_resources
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
1 sibling, 0 replies; 6+ messages in thread
From: Felix Manlunas @ 2017-10-18 17:53 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Derek Chickles, Satanand Burla, Felix Manlunas, Raghu Vatsavayi,
netdev, linux-kernel
On Tue, Oct 17, 2017 at 02:01:45PM -0500, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> This code was tested by compilation only (GCC 7.2.0 was used).
> Please, verify if the actual intention of the code is to fall through.
>
> drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
> index e4a112c..4c3b568 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
> @@ -747,7 +747,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
>
> if (lio_wait_for_oq_pkts(oct))
> dev_err(&oct->pci_dev->dev, "OQ had pending packets\n");
> -
> + /* fall through */
> case OCT_DEV_INTR_SET_DONE:
> /* Disable interrupts */
> oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
> --
> 2.7.4
>
Acked-by: Felix Manlunas <felix.manlunas@cavium.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] liquidio: remove unnecessary NULL check before kfree in delete_glists
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:47 ` [PATCH 1/2] liquidio: remove unnecessary NULL check before kfree in delete_glists Felix Manlunas
@ 2017-10-19 12:28 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-19 12:28 UTC (permalink / raw)
To: garsilva
Cc: derek.chickles, satananda.burla, felix.manlunas, raghu.vatsavayi,
netdev, linux-kernel, garsilva
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Tue, 17 Oct 2017 13:59:20 -0500
> 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>
Applied to net-next.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] liquidio: mark expected switch fall-through in octeon_destroy_resources
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
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-19 12:28 UTC (permalink / raw)
To: garsilva
Cc: derek.chickles, satananda.burla, felix.manlunas, raghu.vatsavayi,
netdev, linux-kernel, garsilva
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Tue, 17 Oct 2017 14:01:45 -0500
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Applied to net-next.
^ permalink raw reply [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).