Commit 13a9d08c authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

net: lan966x: improve error handle in lan966x_fdma_rx_get_frame()

Don't just print a warning.  Clean up and return an error as well.

Fixes: c8349639 ("net: lan966x: Add FDMA functionality")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/YwjgDm/SVd5c1tQU@kiliSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 642b2122
...@@ -425,7 +425,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx) ...@@ -425,7 +425,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx)
lan966x_ifh_get_src_port(skb->data, &src_port); lan966x_ifh_get_src_port(skb->data, &src_port);
lan966x_ifh_get_timestamp(skb->data, &timestamp); lan966x_ifh_get_timestamp(skb->data, &timestamp);
WARN_ON(src_port >= lan966x->num_phys_ports); if (WARN_ON(src_port >= lan966x->num_phys_ports))
goto free_skb;
skb->dev = lan966x->ports[src_port]->dev; skb->dev = lan966x->ports[src_port]->dev;
skb_pull(skb, IFH_LEN * sizeof(u32)); skb_pull(skb, IFH_LEN * sizeof(u32));
...@@ -449,6 +450,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx) ...@@ -449,6 +450,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx)
return skb; return skb;
free_skb:
kfree_skb(skb);
unmap_page: unmap_page:
dma_unmap_page(lan966x->dev, (dma_addr_t)db->dataptr, dma_unmap_page(lan966x->dev, (dma_addr_t)db->dataptr,
FDMA_DCB_STATUS_BLOCKL(db->status), FDMA_DCB_STATUS_BLOCKL(db->status),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment