mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@linux.ibm.com>
To: Haowen Bai <baihaowen@meizu.com>
Cc: Stefan Haberland <sth@linux.ibm.com>,
	Jan Hoeppner <hoeppner@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	<linux-s390@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] s390/dasd: Use kzalloc instead of kmalloc/memset
Date: Tue, 19 Apr 2022 07:43:49 +0200	[thread overview]
Message-ID: <yt9dilr539wq.fsf@linux.ibm.com> (raw)
In-Reply-To: <1650332600-5307-1-git-send-email-baihaowen@meizu.com> (Haowen Bai's message of "Tue, 19 Apr 2022 09:43:20 +0800")

Hi,

Haowen Bai <baihaowen@meizu.com> writes:

> Use kzalloc rather than duplicating its implementation, which
> makes code simple and easy to understand.
>
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
>  drivers/s390/block/dasd_eckd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
> index 8410a25a65c1..74a035c56c3e 100644
> --- a/drivers/s390/block/dasd_eckd.c
> +++ b/drivers/s390/block/dasd_eckd.c
> @@ -1480,7 +1480,7 @@ static int dasd_eckd_pe_handler(struct dasd_device *device,
>  {
>  	struct pe_handler_work_data *data;
>  
> -	data = kmalloc(sizeof(*data), GFP_ATOMIC | GFP_DMA);
> +	data = kzalloc(sizeof(*data), GFP_ATOMIC | GFP_DMA);
>  	if (!data) {
>  		if (mutex_trylock(&dasd_pe_handler_mutex)) {
>  			data = pe_handler_worker;
> @@ -1489,7 +1489,6 @@ static int dasd_eckd_pe_handler(struct dasd_device *device,
>  			return -ENOMEM;
>  		}
>  	} else {
> -		memset(data, 0, sizeof(*data));
>  		data->isglobal = 0;

Maybe also remove the isglobal assigment above, so the whole else block
could go away?

>  	}
>  	INIT_WORK(&data->worker, do_pe_handler_work);

Thanks,
Sven

  reply	other threads:[~2022-04-19  5:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19  1:43 Haowen Bai
2022-04-19  5:43 ` Sven Schnelle [this message]
2022-04-19  6:05   ` [PATCH V2] " Haowen Bai
2022-04-20  6:44     ` Sven Schnelle
2022-04-29 12:52     ` Stefan Haberland

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=yt9dilr539wq.fsf@linux.ibm.com \
    --to=svens@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=baihaowen@meizu.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=sth@linux.ibm.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

Powered by JetHome