From: Len Brown <len.brown@intel.com>
To: Dmitry Torokhov <dtor@insightbb.com>
Cc: linux-acpi@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] ACPI: fix potential OOPS in power driver
Date: Thu, 24 Aug 2006 00:20:56 -0400 [thread overview]
Message-ID: <200608240020.56742.len.brown@intel.com> (raw)
In-Reply-To: <200608232318.06863.dtor@insightbb.com>
On Wednesday 23 August 2006 23:18, Dmitry Torokhov wrote:
> I am wondering what is the reason to have every local variable
> initialized, whether it is needed or not? Aside of increasing
> code size it also hides errors compiler would warn about otherwise.
>
> The patch below fixes potential OOPS, I have more patches that
> remove unnecessary initializations, checks. Would you be interested
> in these?
Style of the original author I guess.
If you'd like to send a patch to clean it up, I'm happy to accept it --
as long as cleanups are not mixed with functionality changes.
> ACPI: fix potential OOPS in power driver
Applied.
thanks,
-Len
>
> drivers/acpi/power.c | 9 +++------
> 1 files changed, 3 insertions(+), 6 deletions(-)
>
> Index: work/drivers/acpi/power.c
> ===================================================================
> --- work.orig/drivers/acpi/power.c
> +++ work/drivers/acpi/power.c
> @@ -216,10 +216,8 @@ static int acpi_power_off_device(acpi_ha
> {
> int result = 0;
> acpi_status status = AE_OK;
> - struct acpi_device *device = NULL;
> struct acpi_power_resource *resource = NULL;
>
> -
> result = acpi_power_get_context(handle, &resource);
> if (result)
> return result;
> @@ -230,13 +228,13 @@ static int acpi_power_off_device(acpi_ha
> if (resource->references) {
> ACPI_DEBUG_PRINT((ACPI_DB_INFO,
> "Resource [%s] is still in use, dereferencing\n",
> - device->pnp.bus_id));
> + resource->device->pnp.bus_id));
> return 0;
> }
>
> if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) {
> ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n",
> - device->pnp.bus_id));
> + resource->device->pnp.bus_id));
> return 0;
> }
>
> @@ -251,8 +249,7 @@ static int acpi_power_off_device(acpi_ha
> return -ENOEXEC;
>
> /* Update the power resource's _device_ power state */
> - device = resource->device;
> - device->power.state = ACPI_STATE_D3;
> + resource->device->power.state = ACPI_STATE_D3;
>
> ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
> resource->name));
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2006-08-24 4:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-24 3:18 [PATCH] ACPI: fix potential OOPS in power driver Dmitry Torokhov
2006-08-24 4:20 ` Len Brown [this message]
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=200608240020.56742.len.brown@intel.com \
--to=len.brown@intel.com \
--cc=akpm@osdl.org \
--cc=dtor@insightbb.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.