From: Joe Perches <joe@perches.com>
To: Haowen Bai <baihaowen@meizu.com>,
Veerasenareddy Burru <vburru@marvell.com>,
Abhijit Ayarekar <aayarekar@marvell.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] octeon_ep: Remove unnecessary cast
Date: Tue, 19 Apr 2022 19:07:14 -0700 [thread overview]
Message-ID: <53b4a92efb83d893230f47ae9988282f3875b355.camel@perches.com> (raw)
In-Reply-To: <1650419232-7982-1-git-send-email-baihaowen@meizu.com>
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).
next prev parent reply other threads:[~2022-04-20 2:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 1:47 [PATCH] octeon_ep: Remove unnecessary cast Haowen Bai
2022-04-20 2:07 ` Joe Perches [this message]
2022-05-24 3:28 ` [PATCH V2] " Haowen Bai
2022-05-24 3:48 ` Joe Perches
2022-05-24 3:51 ` baihaowen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53b4a92efb83d893230f47ae9988282f3875b355.camel@perches.com \
--to=joe@perches.com \
--cc=aayarekar@marvell.com \
--cc=baihaowen@meizu.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vburru@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox