Skip to content

Commit

Permalink
s390/dasd: Use kzalloc instead of kmalloc/memset
Browse files Browse the repository at this point in the history
Use kzalloc rather than duplicating its implementation, which
makes code simple and easy to understand.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://lore.kernel.org/r/20220505141733.1989450-6-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Haowen Bai authored and Jens Axboe committed May 6, 2022
1 parent b9c10f6 commit f1c8781
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/s390/block/dasd_eckd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1480,17 +1480,14 @@ 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;
data->isglobal = 1;
} else {
return -ENOMEM;
}
} else {
memset(data, 0, sizeof(*data));
data->isglobal = 0;
}
INIT_WORK(&data->worker, do_pe_handler_work);
dasd_get_device(device);
Expand Down

0 comments on commit f1c8781

Please sign in to comment.