drivers/s390/block/dasd_eckd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Use kzalloc rather than duplicating its implementation, which
makes code simple and easy to understand.
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
V1->V2: also remove the isglobal assigment above, so the whole else block
could go away
drivers/s390/block/dasd_eckd.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 8410a25a65c1..6b70f9dfff02 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;
@@ -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);
--
2.7.4
Am 19.04.22 um 08:05 schrieb Haowen Bai: > Use kzalloc rather than duplicating its implementation, which > makes code simple and easy to understand. > > Signed-off-by: Haowen Bai <baihaowen@meizu.com> > --- > V1->V2: also remove the isglobal assigment above, so the whole else block > could go away thanks, applied!
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>
> ---
> V1->V2: also remove the isglobal assigment above, so the whole else block
> could go away
>
> drivers/s390/block/dasd_eckd.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
> index 8410a25a65c1..6b70f9dfff02 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;
> @@ -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);
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
© 2016 - 2026 Red Hat, Inc.