RE: [PATCH] drivers: Conversions from kmalloc+memset to k(z|c)alloc.

From: Brown, Len
Date: Fri Jul 21 2006 - 22:23:00 EST



>diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c
>index 32c9d88..037d022 100644
>--- a/drivers/acpi/hotkey.c
>+++ b/drivers/acpi/hotkey.c
>@@ -246,10 +246,8 @@ static char *format_result(union acpi_ob
> {
> char *buf = NULL;
>
>- buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL);
>- if (buf)
>- memset(buf, 0, RESULT_STR_LEN);
>- else
>+ buf = kzalloc(RESULT_STR_LEN, GFP_KERNEL);
>+ if (!buf)
> goto do_fail;

Go ahead and delete the '= NULL' while you're there.

Acked-by: Len Brown <len.brown@xxxxxxxxx>

thanks,
-Len
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/