From: Jeff Garzik <jeff@garzik.org>
To: LKML <linux-kernel@vger.kernel.org>, len.brown@intel.com
Cc: akpm@linux-foundation.org, Alexey Starikovskiy <astarikovskiy@suse.de>
Subject: Re: [PATCH 3/12] ACPI sbs: fix retval warning
Date: Tue, 30 Oct 2007 06:31:55 -0400 [thread overview]
Message-ID: <4727081B.7020508@garzik.org> (raw)
In-Reply-To: <20071023223636.D6D6B1F81A2@havoc.gtf.org>
Jeff Garzik wrote:
> drivers/acpi/sbs.c: In function ‘acpi_battery_add’:
> drivers/acpi/sbs.c:811: warning: ignoring return value of ‘device_create_file’, declared with attribute warn_unused_result
>
> Additional cleanups:
> * use struct acpi_battery in acpi_battery_remove() to clean up function
> calls, just like acpi_battery_add() already does.
>
> * un-indent unregister call, as it mistakenly gives the impression that
> it belongs inside the 'if' test
>
> * remove unneeded braces
>
> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
> ---
>
> diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
> index 90fd09c..c5c011b 100644
> --- a/drivers/acpi/sbs.c
> +++ b/drivers/acpi/sbs.c
> @@ -113,6 +113,7 @@ struct acpi_battery {
> u16 spec;
> u8 id;
> u8 present:1;
> + u8 have_sysfs:1;
> };
>
> #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
> @@ -808,7 +809,8 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
> }
> battery->bat.get_property = acpi_sbs_battery_get_property;
> result = power_supply_register(&sbs->device->dev, &battery->bat);
> - device_create_file(battery->bat.dev, &alarm_attr);
> + if (device_create_file(battery->bat.dev, &alarm_attr) == 0)
> + battery->have_sysfs = 1;
> printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
> ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
> battery->name, sbs->battery->present ? "present" : "absent");
> @@ -817,14 +819,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
>
> static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
> {
> - if (sbs->battery[id].bat.dev)
> - device_remove_file(sbs->battery[id].bat.dev, &alarm_attr);
> - power_supply_unregister(&sbs->battery[id].bat);
> + struct acpi_battery *battery = &sbs->battery[id];
> +
> + if (battery->have_sysfs)
> + device_remove_file(battery->bat.dev, &alarm_attr);
> +
> + power_supply_unregister(&battery->bat);
> +
> #ifdef CONFIG_ACPI_PROCFS
> - if (sbs->battery[id].proc_entry) {
> - acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry),
> - acpi_battery_dir);
> - }
> + if (sbs->battery[id].proc_entry)
> + acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
Len, this seems to have been missed in the recent ACPI push.
Can you queue this, or a similar fix, for the recently-added compiler
warning (at the top of this email)?
Jeff
next prev parent reply other threads:[~2007-10-30 10:32 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 22:36 [PATCH 1/12] X86: fix !CONFIG_SMP warning in processor.c Jeff Garzik
2007-10-23 22:36 ` [PATCH 2/12] X86: fix nvidia HPET warning Jeff Garzik
2007-10-24 4:05 ` Jeremy Fitzhardinge
2007-10-24 6:05 ` Jeff Garzik
2007-10-24 12:03 ` Ingo Molnar
2007-10-23 22:36 ` [PATCH 3/12] ACPI sbs: fix retval warning Jeff Garzik
2007-10-30 10:31 ` Jeff Garzik [this message]
2007-10-23 22:36 ` [PATCH 4/12] riscom8: fix SMP brokenness Jeff Garzik
2007-10-24 6:47 ` Jiri Slaby
2007-10-24 6:52 ` Jeff Garzik
2007-10-24 7:44 ` Jiri Slaby
2007-10-24 7:10 ` Andrew Morton
2007-10-24 7:44 ` Jiri Slaby
2007-10-24 8:00 ` Andrew Morton
2008-02-07 0:29 ` [bug] " Ingo Molnar
2008-02-20 20:37 ` Jeff Garzik
2008-02-20 22:00 ` Alan Cox
2007-10-23 22:36 ` [PATCH 5/12] ISDN/sc: fix longstanding warning Jeff Garzik
2007-10-24 7:24 ` Karsten Keil
2007-10-23 22:36 ` [PATCH 6/12] KVM: work around SMP requirement Jeff Garzik
2007-10-23 22:44 ` Adrian Bunk
2007-10-23 22:46 ` Jeff Garzik
2007-10-24 8:36 ` Avi Kivity
2007-10-24 12:32 ` [patch] kvm: fix !SMP build error Ingo Molnar
2007-10-24 12:36 ` Ingo Molnar
2007-10-24 18:11 ` Ingo Molnar
2007-11-01 3:34 ` Randy Dunlap
2007-11-01 8:31 ` Ingo Molnar
2007-11-01 13:10 ` Avi Kivity
2007-11-01 14:59 ` Ingo Molnar
2007-11-01 21:16 ` Avi Kivity
2007-10-23 22:36 ` [PATCH 7/12] eexpress: fix !SMP unused-var warning Jeff Garzik
2007-10-23 22:36 ` [PATCH 8/12] ni5010: kill unused variable Jeff Garzik
2007-10-23 22:36 ` [PATCH 9/12] cgroup: " Jeff Garzik
2007-10-24 0:19 ` Paul Menage
2007-10-23 22:36 ` [PATCH 10/12] mac80211: fix warning created by BIT() Jeff Garzik
2007-10-23 23:15 ` Randy Dunlap
2007-10-23 22:36 ` [PATCH 11/12] NET: fix subqueue bugs Jeff Garzik
2007-10-23 22:38 ` David Miller
2007-10-23 22:40 ` Jeff Garzik
2007-10-23 22:36 ` [PATCH 12/12] sound/isa: fix printk format Jeff Garzik
2007-10-24 4:03 ` [PATCH 1/12] X86: fix !CONFIG_SMP warning in processor.c Jeremy Fitzhardinge
2007-10-24 12:01 ` Ingo Molnar
2007-10-24 16:27 ` [2.6 patch] x86/kernel/acpi/processor.c: fix SMP=n warning Adrian Bunk
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=4727081B.7020508@garzik.org \
--to=jeff@garzik.org \
--cc=akpm@linux-foundation.org \
--cc=astarikovskiy@suse.de \
--cc=len.brown@intel.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