From: Jiri Slaby <jirislaby@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/acpi/battery.c cleanups
Date: Sun, 23 Jul 2006 09:48:52 +0159 [thread overview]
Message-ID: <44C329FB.3010901@gmail.com> (raw)
In-Reply-To: <20060723002907.GA8886@leiferikson.gentoo>
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
next prev parent reply other threads:[~2006-07-23 7:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-23 0:29 [PATCH] drivers/acpi/battery.c cleanups Johannes Weiner
2006-07-23 7:49 ` Jiri Slaby [this message]
2006-07-23 10:04 ` Johannes Weiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44C329FB.3010901@gmail.com \
--to=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox