From: Thorsten Blum <thorsten.blum@linux.dev>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: Satish Kharat <satishkh@cisco.com>,
Sesidhar Baddela <sebaddel@cisco.com>,
Karan Tilak Kumar <kartilak@cisco.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] scsi: fnic: Use vzalloc() instead of vmalloc() and memset(0)
Date: Tue, 8 Oct 2024 13:02:01 +0200 [thread overview]
Message-ID: <2D16B4A0-DC8F-4448-93B1-508FD9F92774@linux.dev> (raw)
In-Reply-To: <596a6bd4-88b3-4836-94ec-b2930c9b0062@wdc.com>
On 8. Oct 2024, at 12:25, Johannes Thumshirn wrote:
> On 08.10.24 11:53, Thorsten Blum wrote:
>> Use vzalloc() instead of vmalloc() followed by memset(0) to simplify the
>> functions fnic_trace_buf_init() and fnic_fc_trace_init().
>>
>> Remove unnecessary unsigned long cast.
>>
>> Compile-tested only.
>>
>> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>> ---
>> Changes in v2:
>> - Remove unsigned long cast as suggested by Johannes Thumshirn
>> - Link to v1: https://lore.kernel.org/linux-kernel/20241007115840.2239-6-thorsten.blum@linux.dev/
>> ---
>> drivers/scsi/fnic/fnic_trace.c | 14 +++-----------
>> 1 file changed, 3 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
>> index aaa4ea02fb7c..c2413e0e4eaa 100644
>> --- a/drivers/scsi/fnic/fnic_trace.c
>> +++ b/drivers/scsi/fnic/fnic_trace.c
>> @@ -485,7 +485,7 @@ int fnic_trace_buf_init(void)
>> }
>>
>> fnic_trace_entries.page_offset =
>> - vmalloc(array_size(fnic_max_trace_entries,
>> + vzalloc(array_size(fnic_max_trace_entries,
>> sizeof(unsigned long)));
>
> Sorry for not having spotted it earlier, but all those
> vzalloc(array_size(foo, bar)); calls can be turned into vcalloc(foo, bar);
No worries, but removing the unsigned long casts actually doesn't work:
drivers/scsi/fnic/fnic_trace.c:559:27: error: incompatible pointer to integer conversion assigning to 'unsigned long' from 'typeof (vzalloc_noprof(size_mul(((1UL) << 12), fnic_fc_trace_max_pages)))' (aka 'void *') [-Wint-conversion]
559 | fnic_fc_ctlr_trace_buf_p =
| ^
560 | vzalloc(array_size(PAGE_SIZE, fnic_fc_trace_max_pages));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
I'll submit a v3.
Thanks,
Thorsten
next prev parent reply other threads:[~2024-10-08 11:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 9:51 [PATCH v2] scsi: fnic: Use vzalloc() instead of vmalloc() and memset(0) Thorsten Blum
2024-10-08 10:25 ` Johannes Thumshirn
2024-10-08 11:02 ` Thorsten Blum [this message]
2024-10-09 4:17 ` kernel test robot
2024-10-09 4:38 ` kernel test robot
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=2D16B4A0-DC8F-4448-93B1-508FD9F92774@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=kartilak@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=satishkh@cisco.com \
--cc=sebaddel@cisco.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