OSDN Git Service

s390/dasd: Use kzalloc instead of kmalloc/memset
authorHaowen Bai <baihaowen@meizu.com>
Thu, 5 May 2022 14:17:33 +0000 (16:17 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 6 May 2022 02:08:27 +0000 (20:08 -0600)
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>
drivers/s390/block/dasd_eckd.c

index e46461b..836838f 100644 (file)
@@ -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;
@@ -1488,9 +1488,6 @@ static int dasd_eckd_pe_handler(struct dasd_device *device,
                } else {
                        return -ENOMEM;
                }
-       } else {
-               memset(data, 0, sizeof(*data));
-               data->isglobal = 0;
        }
        INIT_WORK(&data->worker, do_pe_handler_work);
        dasd_get_device(device);