diff options
author | Vishwas Srivastava <vishu.kernel@gmail.com> | 2016-01-26 12:46:42 +0530 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2016-02-06 16:39:31 +0100 |
commit | 2300184f702656b72394e458bf15f7aaba8af892 (patch) | |
tree | 72c09dfd72d37919df07769bd54b90db8d70fe6c /drivers/net | |
parent | 1a9115ecfecf8713de077a68e6c8f599a55fc759 (diff) | |
download | u-boot-imx-2300184f702656b72394e458bf15f7aaba8af892.zip u-boot-imx-2300184f702656b72394e458bf15f7aaba8af892.tar.gz u-boot-imx-2300184f702656b72394e458bf15f7aaba8af892.tar.bz2 |
net: davinci_emac: fix NULL check after pointer dereference
NULL check is made after the pointer dereference. This patch
fixes this issue.
Signed-off-by: Vishwas Srivastava <vishu.kernel@gmail.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/davinci_emac.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 6f2dc8d..b030498 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -692,8 +692,10 @@ static int davinci_eth_rcv_packet (struct eth_device *dev) davinci_invalidate_rx_descs(); rx_curr_desc = emac_rx_active_head; + if (!rx_curr_desc) + return 0; status = rx_curr_desc->pkt_flag_len; - if ((rx_curr_desc) && ((status & EMAC_CPPI_OWNERSHIP_BIT) == 0)) { + if ((status & EMAC_CPPI_OWNERSHIP_BIT) == 0) { if (status & EMAC_CPPI_RX_ERROR_FRAME) { /* Error in packet - discard it and requeue desc */ printf ("WARN: emac_rcv_pkt: Error in packet\n"); |