net: octeontx2: Fix the confusion in buffer alloc failure path
Pavel pointed that the return of dma_addr_t in otx2_alloc_rbuf/__otx2_alloc_rbuf() seem suspicious because a negative error code may be returned in some cases. For a dma_addr_t, the error code such as -ENOMEM does seem a valid value, so we can't judge if the buffer allocation fail or not based on that value. Add a parameter for otx2_alloc_rbuf/__otx2_alloc_rbuf() to store the dma address and make the return value to indicate if the buffer allocation really fail or not. Reported-by:Pavel Machek <pavel@ucw.cz> Signed-off-by:
Kevin Hao <haokexin@gmail.com> Tested-by:
Subbaraya Sundeep <sbhatta@marvell.com> Reviewed-by:
Alexander Duyck <alexanderduyck@fb.com> Signed-off-by:
David S. Miller <davem@davemloft.net>
Showing
- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c 18 additions, 20 deletionsdrivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h 4 additions, 3 deletionsdrivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c 2 additions, 3 deletionsdrivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
Please register or sign in to comment