summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Manlunas <felix.manlunas@cavium.com>2017-02-07 12:10:58 -0800
committerDavid S. Miller <davem@davemloft.net>2017-02-07 15:37:43 -0500
commit76e0e70e6452b971a69cc9794ff4a6715c11f7f2 (patch)
treea9914ee97e172cb0be8b506033f81f9988f74f97
parentca6d4480f87db9d9470d3d7bbe445953fa105e57 (diff)
downloadlinux-76e0e70e6452b971a69cc9794ff4a6715c11f7f2.tar.bz2
liquidio: do not dereference pointer if it's NULL
Fix smatch errors by not dereferencing iq pointer if it's NULL. See http://marc.info/?l=kernel-janitors&m=148637299004834&w=2 Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/cavium/liquidio/lio_main.c2
-rw-r--r--drivers/net/ethernet/cavium/liquidio/lio_vf_main.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index c12cfa4113cc..a3c7b999e526 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -2447,7 +2447,7 @@ static int liquidio_napi_poll(struct napi_struct *napi, int budget)
/* force enable interrupt if reg cnts are high to avoid wraparound */
if ((work_done < budget && tx_done) ||
- (iq->pkt_in_done >= MAX_REG_CNT) ||
+ (iq && iq->pkt_in_done >= MAX_REG_CNT) ||
(droq->pkt_count >= MAX_REG_CNT)) {
tx_done = 1;
napi_complete_done(napi, work_done);
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index 631f1c0f9e4d..0536cb9f6182 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -1632,7 +1632,7 @@ static int liquidio_napi_poll(struct napi_struct *napi, int budget)
/* force enable interrupt if reg cnts are high to avoid wraparound */
if ((work_done < budget && tx_done) ||
- (iq->pkt_in_done >= MAX_REG_CNT) ||
+ (iq && iq->pkt_in_done >= MAX_REG_CNT) ||
(droq->pkt_count >= MAX_REG_CNT)) {
tx_done = 1;
napi_complete_done(napi, work_done);