All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schwermer <sven@svenschwermer.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Linux LED Subsystem" <linux-leds@vger.kernel.org>,
	"Pavel Machek" <pavel@ucw.cz>, "Rob Herring" <robh+dt@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Lee Jones" <lee.jones@linaro.org>,
	"post@lespocky.de" <post@lespocky.de>
Subject: Re: [PATCH v3 2/2] leds: Add PWM multicolor driver
Date: Sun, 6 Feb 2022 12:04:34 +0100	[thread overview]
Message-ID: <0df04a77-6765-f9bd-a678-9016d0c0c5d5@svenschwermer.de> (raw)
In-Reply-To: <CAHp75VeSD5bYERp=s9Dzd0xScVc+sYSdc8W4XBfCVXJgyWMPyA@mail.gmail.com>

> Skipping mutex destruction is not critical, but in general if you wish 
> to free allocated resource, it should be done in reversed order...
As far as I can tell, the ordering is already reversed:

mcnode = device_get_named_child_node(&pdev->dev, "multi-led");
/* ... */
mutex_init(&priv->lock);
/* ... */
fwnode_for_each_child_node(mcnode, fwnode) {
     /* ... */
     fwnode_handle_put(fwnode);
     goto destroy_mutex;
     /* ... */
}
/* ... */
destroy_mutex:
     mutex_destroy(&priv->lock);
release_mcnode:
     fwnode_handle_put(mcnode);
out:
     return ret;

>             +destroy_mutex:
>             +       mutex_destroy(&priv->lock);
> 
> 
>         Wrong ordering here and in ->remove().
> 
>         Don't mix devm_* with non-devm_* calls.
> 
>     What do you mean by this?
> 
> 
> ...which is exactly the issue with this code because of the use of 
> devm_*() calls mixed with non-devm_*() ones.
> 
> TL;DR: ordering is broken here. And to fix it you need either a) to 
> convert all calls to be devm_*(), or b) make them all non-devm, or c) 
> regroup resource allocation so that all devm followed by non-devm ones.Which non-devm calls are you referring to?

Thanks for your patience,
Sven

  parent reply	other threads:[~2022-02-06 11:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 10:48 [PATCH v3 0/2] Multicolor PWM LED support sven
2022-01-26 10:48 ` [PATCH v3 1/2] dt-bindings: leds: Add multicolor PWM LED bindings sven
2022-01-27 21:24   ` Jacek Anaszewski
2022-01-28 20:36     ` Marek Behún
2022-01-28 23:04       ` Jacek Anaszewski
2022-01-28 23:26         ` Marek Behún
2022-01-31  7:10           ` Alexander Dahl
2022-01-31  8:55             ` Sven Schwermer
2022-02-12 11:54         ` Pavel Machek
2022-01-26 10:48 ` [PATCH v3 2/2] leds: Add PWM multicolor driver sven
2022-02-02 12:33   ` Andy Shevchenko
2022-02-06  9:17     ` Sven Schwermer
     [not found]       ` <CAHp75VeSD5bYERp=s9Dzd0xScVc+sYSdc8W4XBfCVXJgyWMPyA@mail.gmail.com>
2022-02-06 11:04         ` Sven Schwermer [this message]
2022-02-06 12:25           ` Andy Shevchenko

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=0df04a77-6765-f9bd-a678-9016d0c0c5d5@svenschwermer.de \
    --to=sven@svenschwermer.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=post@lespocky.de \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.