All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mfd: stm32-timers: depopulate child devices on populate failure
Date: Fri, 3 Jul 2026 08:47:01 +0100	[thread overview]
Message-ID: <20260703074701.GE2108533@google.com> (raw)
In-Reply-To: <20260703065016.97181-1-pengpeng@iscas.ac.cn>

On Fri, 03 Jul 2026, Pengpeng Hou wrote:

> Hi Lee,
> 
> Thanks for taking a look.
> 
> I checked devm_of_platform_populate(), but I don't think it covers this
> particular failure path on its own.
> 
> devm_of_platform_populate() only installs the devres cleanup after
> of_platform_populate() has returned success.  If of_platform_populate()
> returns an error after creating some earlier children, the helper just
> frees its devres record and those partial children are not depopulated.
> 
> For stm32-timers, I think we still need the explicit ordering used by
> remove: depopulate children before stm32_timers_dma_remove().  The child
> drivers get the parent drvdata, and the PWM child can call the parent
> stm32_timers_dma_burst_read() helper, so releasing the parent DMA
> channels while partially-created children remain would keep the same
> ordering problem the remove path avoids.
> 
> I agree the inline unwind is not the clearest form.  I can send a v2
> using a normal goto unwind label and a short comment explaining the
> partial-populate case, unless you prefer a different shape.

I'm not concerned about where in the file the call sits.  Calls like
this that fail usually do so cleanly.  I think this deserves a wider
piece of work that ensures that of_platform_populate() doesn't leave
dangling resources when it fails.

Also, why doesn't every call to of_platform_populate() have this?

-- 
Lee Jones

      reply	other threads:[~2026-07-03  7:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15  6:30 [PATCH] mfd: stm32-timers: depopulate child devices on populate failure Pengpeng Hou
2026-07-01 21:42 ` Lee Jones
2026-07-03  6:50   ` Pengpeng Hou
2026-07-03  7:47     ` Lee Jones [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=20260703074701.GE2108533@google.com \
    --to=lee@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=pengpeng@iscas.ac.cn \
    /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.