From: Intiyaz Basha Date: Fri, 18 Aug 2017 20:07:19 +0000 (-0700) Subject: liquidio: fix Smatch error X-Git-Tag: v4.14-rc1~130^2~209 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2896116dbc7be7cabd5db414e008aef4a5e0a00;p=platform%2Fkernel%2Flinux-rpi3.git liquidio: fix Smatch error 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 Signed-off-by: Intiyaz Basha Signed-off-by: Felix Manlunas Signed-off-by: David S. Miller --- 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);