mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Andres Salomon <dilinger@queued.net>
Cc: linux-kernel@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>,
	akpm@linux-foundation.org, cbou@mail.ru
Subject: Re: [PATCH 2/2] power: fix incorrect unregistration in power_supply_create_attrs error path
Date: Wed, 12 Dec 2007 22:52:49 +0300	[thread overview]
Message-ID: <20071212195249.GB16241@localhost.localdomain> (raw)
In-Reply-To: <20071212141259.67b4e1d9@ephemeral>

On Wed, Dec 12, 2007 at 02:12:59PM -0500, Andres Salomon wrote:
> 
> In power_supply_create_attrs(), we create static attributes as referenced
> by power_supply_static_attrs[i].  After that, if we fail, we unregister
> via power_supply_static_attrs[psy->properties[i]].  This is incorrect, as
> psy->properties has absolutely no bearing on static attribs.  This patch
> fixes it to unregister the correct attrib.
> 
> Another line which was unnecessarily line wrapped is also unwrapped.

Will apply to battery-2.6.git, and will try to push this into 2.6.24.

Much thanks.

> Signed-off-by: Andres Salomon <dilinger@debian.org>
> ---
>  drivers/power/power_supply_sysfs.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
> index 0331e82..8efedba 100644
> --- a/drivers/power/power_supply_sysfs.c
> +++ b/drivers/power/power_supply_sysfs.c
> @@ -153,8 +153,7 @@ dynamics_failed:
>  			   &power_supply_attrs[psy->properties[j]]);
>  statics_failed:
>  	while (i--)
> -		device_remove_file(psy->dev,
> -			   &power_supply_static_attrs[psy->properties[i]]);
> +		device_remove_file(psy->dev, &power_supply_static_attrs[i]);
>  succeed:
>  	return rc;
>  }
> @@ -164,8 +163,7 @@ void power_supply_remove_attrs(struct power_supply *psy)
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++)
> -		device_remove_file(psy->dev,
> -			    &power_supply_static_attrs[i]);
> +		device_remove_file(psy->dev, &power_supply_static_attrs[i]);
>  
>  	for (i = 0; i < psy->num_properties; i++)
>  		device_remove_file(psy->dev,
> -- 
> 1.5.3.5
> 
> 

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

      reply	other threads:[~2007-12-12 19:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-12 19:12 Andres Salomon
2007-12-12 19:52 ` Anton Vorontsov [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=20071212195249.GB16241@localhost.localdomain \
    --to=avorontsov@ru.mvista.com \
    --cc=akpm@linux-foundation.org \
    --cc=cbou@mail.ru \
    --cc=dilinger@queued.net \
    --cc=dwmw2@infradead.org \
    --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

all inboxes | Powered by JetHome®