Messages in this thread | | | Date | Sun, 23 Jul 2006 09:48:52 +0159 | From | Jiri Slaby <> | Subject | Re: [PATCH] drivers/acpi/battery.c cleanups |
| |
Johannes Weiner napsal(a): > Removed assignment casts, substituted kmalloc+memset with kzalloc, made > functions void if they never return a value. Style adjustments. > > Signed-off-by: Johannes Weiner <hnazfoo@gmail.com> > > --- > > > ------------------------------------------------------------------------ > > diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c > index 6e52217..85f6a23 100644 > --- a/drivers/acpi/battery.c > +++ b/drivers/acpi/battery.c > @@ -147,7 +147,7 @@ acpi_battery_get_info(struct acpi_batter > return -ENODEV; > } > > - package = (union acpi_object *)buffer.pointer; > + package = buffer.pointer; > > /* Extract Package Data */ > > @@ -158,12 +158,11 @@ acpi_battery_get_info(struct acpi_batter > goto end; > } > > - data.pointer = kmalloc(data.length, GFP_KERNEL); > + data.pointer = kzalloc(data.length, GFP_KERNEL); > if (!data.pointer) { > result = -ENOMEM; > goto end; > } > - memset(data.pointer, 0, data.length); > > status = acpi_extract_package(package, &format, &data); > if (ACPI_FAILURE(status)) { > @@ -173,11 +172,11 @@ acpi_battery_get_info(struct acpi_batter > goto end; > } > > - end: > +end: > kfree(buffer.pointer); > > if (!result) > - (*bif) = (struct acpi_battery_info *)data.pointer; > + (*bif) = data.pointer;
still unneeded ()
> > return result; > } > @@ -207,7 +206,7 @@ acpi_battery_get_status(struct acpi_batt > return -ENODEV; > } > > - package = (union acpi_object *)buffer.pointer; > + package = buffer.pointer; > > /* Extract Package Data */ > > @@ -218,12 +217,11 @@ acpi_battery_get_status(struct acpi_batt > goto end; > } > > - data.pointer = kmalloc(data.length, GFP_KERNEL); > + data.pointer = kzalloc(data.length, GFP_KERNEL); > if (!data.pointer) { > result = -ENOMEM; > goto end; > } > - memset(data.pointer, 0, data.length); > > status = acpi_extract_package(package, &format, &data); > if (ACPI_FAILURE(status)) { > @@ -233,11 +231,11 @@ acpi_battery_get_status(struct acpi_batt > goto end; > } > > - end: > +end: > kfree(buffer.pointer); > > if (!result) > - (*bst) = (struct acpi_battery_status *)data.pointer; > + (*bst) = data.pointer;
and here
regards, -- <a href="http://www.fi.muni.cz/~xslaby/">Jiri Slaby</a> faculty of informatics, masaryk university, brno, cz e-mail: jirislaby gmail com, gpg pubkey fingerprint: B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |