Re: [PATCH] s390/dasd: Use kzalloc instead of kmalloc/memset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Haowen Bai <baihaowen@xxxxxxxxx> writes:

> Use kzalloc rather than duplicating its implementation, which
> makes code simple and easy to understand.
>
> Signed-off-by: Haowen Bai <baihaowen@xxxxxxxxx>
> ---
>  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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux