From: Hannes Reinecke <hare@suse.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
satishkh@cisco.com, sebaddel@cisco.com, kartilak@cisco.com,
jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] scsi: fnic: Use kmalloc instead of vmalloc for a small memory allocation
Date: Wed, 6 May 2020 14:27:58 +0200 [thread overview]
Message-ID: <9675b485-cc1e-d928-6888-00d1d666b599@suse.de> (raw)
In-Reply-To: <20200423204620.26395-1-christophe.jaillet@wanadoo.fr>
On 4/23/20 10:46 PM, Christophe JAILLET wrote:
> 'struct fc_trace_flag_type' is just a few bytes long. There is no need
> to allocate such a structure with vmalloc. Using kmalloc instead.
>
> While at it, axe a useless test when freeing the memory.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/scsi/fnic/fnic_debugfs.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
> index 13f7d88d6e57..8d6ce3470594 100644
> --- a/drivers/scsi/fnic/fnic_debugfs.c
> +++ b/drivers/scsi/fnic/fnic_debugfs.c
> @@ -58,8 +58,7 @@ int fnic_debugfs_init(void)
> fnic_trace_debugfs_root);
>
> /* Allocate memory to structure */
> - fc_trc_flag = (struct fc_trace_flag_type *)
> - vmalloc(sizeof(struct fc_trace_flag_type));
> + fc_trc_flag = kmalloc(sizeof(*fc_trc_flag), GFP_KERNEL);
>
> if (fc_trc_flag) {
> fc_trc_flag->fc_row_file = 0;
> @@ -87,8 +86,7 @@ void fnic_debugfs_terminate(void)
> debugfs_remove(fnic_trace_debugfs_root);
> fnic_trace_debugfs_root = NULL;
>
> - if (fc_trc_flag)
> - vfree(fc_trc_flag);
> + kfree(fc_trc_flag);
> }
>
> /*
>
Reviewed-by: Hannes Reinecke <har@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
next prev parent reply other threads:[~2020-05-06 12:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 20:46 [PATCH] scsi: fnic: Use kmalloc instead of vmalloc for a small memory allocation Christophe JAILLET
2020-04-24 9:30 ` Dan Carpenter
2020-05-06 12:27 ` Hannes Reinecke [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-04-24 14:50 Markus Elfring
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=9675b485-cc1e-d928-6888-00d1d666b599@suse.de \
--to=hare@suse.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=jejb@linux.ibm.com \
--cc=kartilak@cisco.com \
--cc=kernel-janitors@vger.kernel.org \
--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