All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] liquidio: fix Smatch error
@ 2017-08-18 20:07 Felix Manlunas
  2017-08-18 22:21 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Manlunas @ 2017-08-18 20:07 UTC (permalink / raw)
  To: davem
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla, intiyaz.basha

From: Intiyaz Basha <intiyaz.basha@cavium.com>

Fix Smatch error by not dereferencing iq pointer if it's NULL.

See http://marc.info/?l=kernel-janitors&m=150296723301129&w=2

Also, remove unnecessary parentheses.

Fixes: d314ac222829 ("liquidio: moved liquidio_napi_poll to lio_core.c")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
 drivers/net/ethernet/cavium/liquidio/lio_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
index d4f0646..0e7896c 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_core.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c
@@ -668,8 +668,8 @@ static int liquidio_napi_poll(struct napi_struct *napi, int budget)
 
 #define MAX_REG_CNT  2000000U
 	/* force enable interrupt if reg cnts are high to avoid wraparound */
-	if (((work_done < budget) && (tx_done)) ||
-	    (iq->pkt_in_done >= MAX_REG_CNT) ||
+	if ((work_done < budget && tx_done) ||
+	    (iq && iq->pkt_in_done >= MAX_REG_CNT) ||
 	    (droq->pkt_count >= MAX_REG_CNT)) {
 		tx_done = 1;
 		napi_complete_done(napi, work_done);
-- 
1.8.3.1

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

* Re: [PATCH net-next] liquidio: fix Smatch error
  2017-08-18 20:07 [PATCH net-next] liquidio: fix Smatch error Felix Manlunas
@ 2017-08-18 22:21 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-08-18 22:21 UTC (permalink / raw)
  To: felix.manlunas
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla, intiyaz.basha

From: Felix Manlunas <felix.manlunas@cavium.com>
Date: Fri, 18 Aug 2017 13:07:19 -0700

> From: Intiyaz Basha <intiyaz.basha@cavium.com>
> 
> Fix Smatch error by not dereferencing iq pointer if it's NULL.
> 
> See http://marc.info/?l=kernel-janitors&m=150296723301129&w=2
> 
> Also, remove unnecessary parentheses.
> 
> Fixes: d314ac222829 ("liquidio: moved liquidio_napi_poll to lio_core.c")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>

Applied.

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

end of thread, other threads:[~2017-08-18 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-18 20:07 [PATCH net-next] liquidio: fix Smatch error Felix Manlunas
2017-08-18 22:21 ` David Miller

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.