linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Sebastian Reichel <sre@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Srikant Ritolia <srikant.ritolia@gmail.com>,
	Srikant Ritolia <s.ritolia@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	linux-pm@vger.kernel.org, d.wadhawan@samsung.com,
	vidushi.koul@samsung.com
Subject: Re: [PATCH] power: max77693_charger: Better sysfs creation and using devm APIs
Date: Sat, 17 Dec 2016 18:28:47 +0200	[thread overview]
Message-ID: <20161217162847.GA30265@kozik-lap> (raw)
In-Reply-To: <20161217160446.hakmgpqp5hvb6h5k@earth>

On Sat, Dec 17, 2016 at 05:04:46PM +0100, Sebastian Reichel wrote:
> Hi,
> 
> On Sat, Dec 10, 2016 at 09:56:27PM +0200, Krzysztof Kozlowski wrote:
> > On Sat, Dec 10, 2016 at 07:49:25PM +0530, Srikant Ritolia wrote:
> > > On Sat, Dec 10, 2016 at 1:18 PM, Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > > On Fri, Dec 09, 2016 at 02:21:38PM +0530, Srikant Ritolia wrote:
> >  >
> > > >>                                               &max77693_charger_desc,
> > > >>                                               &psy_cfg);
> > > >>       if (IS_ERR(chg->charger)) {
> > > >>               dev_err(&pdev->dev, "failed: power supply register\n");
> > > >>               ret = PTR_ERR(chg->charger);
> > > >> -             goto err;
> > > >
> > > > Missing sysfs cleanup.
> > > >
> > > > Best regards,
> > > > Krzysztof
> > > >
> > > 
> > > Thanks for pointing this out.
> > > To overcome this I will use sysfs_create_group after devm_power_supply_register.
> > > Then I would not need to do this sysfs cleanup on failure of power
> > > supply register.
> > 
> > I am not sure if this is good idea. This patch does not bring any
> > particular noticeable benefit except less lines of code. It is not worth
> > breaking things just for that reason...
> 
> I like less lines of code. How does the changed registration order
> break anything? The changed registration order makes sense anyways,
> since it then matches the (reversed) removal order.

By broken things I meant possible errors introduced with devm
conversion (like that one spotted above). To me personally, converting
to devm on its own mostly does not bring benefits except few cases when
a lot of code disappears. On the other hand it hides the order of
cleanup making it slightly more difficult to review. Overall - not many
benefits, some things hidden.

However I understand that this is highly subjective so I am not against
if others like this approach.

Best regards,
Krzysztof


      reply	other threads:[~2016-12-17 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09  8:51 [PATCH] power: max77693_charger: Better sysfs creation and using devm APIs Srikant Ritolia
2016-12-10  7:48 ` Krzysztof Kozlowski
2016-12-10 14:19   ` Srikant Ritolia
2016-12-10 19:56     ` Krzysztof Kozlowski
2016-12-17 16:04       ` Sebastian Reichel
2016-12-17 16:28         ` Krzysztof Kozlowski [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=20161217162847.GA30265@kozik-lap \
    --to=krzk@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=d.wadhawan@samsung.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=s.ritolia@samsung.com \
    --cc=sre@kernel.org \
    --cc=srikant.ritolia@gmail.com \
    --cc=vidushi.koul@samsung.com \
    /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;
as well as URLs for NNTP newsgroup(s).