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>
This commit is contained in:
Vishwas Srivastava 2016-01-26 12:46:42 +05:30 committed by Anatolij Gustschin
parent 1a9115ecfe
commit 2300184f70

View file

@ -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");