[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53b4a92efb83d893230f47ae9988282f3875b355.camel@perches.com>
Date: Tue, 19 Apr 2022 19:07:14 -0700
From: Joe Perches <joe@...ches.com>
To: Haowen Bai <baihaowen@...zu.com>,
Veerasenareddy Burru <vburru@...vell.com>,
Abhijit Ayarekar <aayarekar@...vell.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] octeon_ep: Remove unnecessary cast
On Wed, 2022-04-20 at 09:47 +0800, Haowen Bai wrote:
> Fix the following coccicheck warning:
>
> ./drivers/net/ethernet/marvell/octeon_ep/octep_rx.c:161:18-40: WARNING:
> casting value returned by memory allocation function to (struct
> octep_rx_buffer *) is useless.
[]
> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c
[]
> @@ -158,8 +158,7 @@ static int octep_setup_oq(struct octep_device *oct, int q_no)
> goto desc_dma_alloc_err;
> }
>
> - oq->buff_info = (struct octep_rx_buffer *)
> - vzalloc(oq->max_count * OCTEP_OQ_RECVBUF_SIZE);
> + oq->buff_info = vzalloc(oq->max_count * OCTEP_OQ_RECVBUF_SIZE);
> if (unlikely(!oq->buff_info)) {
> dev_err(&oct->pdev->dev,
> "Failed to allocate buffer info for OQ-%d\n", q_no);
probably better to use kvcalloc or maybe vcalloc if oq->max_count is
always expected to be huge.
OCTEP_OQ_RECVBUF_SIZE is pretty small (just a pointer and a u64).
Powered by blists - more mailing lists