From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: j.neuschaefer@gmx.net, avifishman70@gmail.com,
benjaminfair@google.com, daniel.lezcano@linaro.org,
devicetree@vger.kernel.org, krzk+dt@kernel.org,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-watchdog@vger.kernel.org, linux@roeck-us.net,
mturquette@baylibre.com, openbmc@lists.ozlabs.org,
p.zabel@pengutronix.de, robh+dt@kernel.org, sboyd@kernel.org,
tali.perry1@gmail.com, tglx@linutronix.de, tmaimon77@gmail.com,
venture@google.com, wim@linux-watchdog.org, yuenn@google.com
Subject: Re: [PATCH v6 2/2] clk: wpcm450: Add Nuvoton WPCM450 clock/reset controller driver
Date: Sat, 22 Apr 2023 17:56:32 +0200 [thread overview]
Message-ID: <ZEQDsLYaRywV9IbF@probook> (raw)
In-Reply-To: <1f1b088c-85d2-13ed-bbb1-043409dbe894@wanadoo.fr>
[-- Attachment #1: Type: text/plain, Size: 1594 bytes --]
On Thu, Apr 20, 2023 at 07:32:07AM +0200, Christophe JAILLET wrote:
> Le 19/04/2023 à 23:52, Jonathan Neuschäfer a écrit :
> > On Sat, Apr 15, 2023 at 02:16:09PM +0200, Christophe JAILLET wrote:
> > > Le 15/04/2023 à 13:13, Jonathan Neuschäfer a écrit :
[...]
> > > > + // Enables/gates
> > > > + for (i = 0; i < ARRAY_SIZE(clken_data); i++) {
> > > > + const struct wpcm450_clken_data *data = &clken_data[i];
> > > > +
> > > > + hw = clk_hw_register_gate_parent_data(NULL, data->name, &data->parent, data->flags,
> > > > + clk_base + REG_CLKEN, data->bitnum,
> > > > + data->flags, &wpcm450_clk_lock);
> > >
> > > If an error occures in the 'for' loop or after it, should this be
> > > clk_hw_unregister_gate()'ed somewhere?
> >
> > Ideally yes —
> >
> > in this case, if the clock driver fails, the system is arguably in such
> > a bad state that there isn't much point in bothering.
> >
>
> Ok, but below we care about freeing clk_data->hws in the error handling
> path.
>
> Why do we handle just half of the resources?
> Shouldn't it be all (to be clean, if it makes sense) or nothing (to reduce
> the LoC and have a smaller driver)?
I thought about it for a bit, and I think I'm ok with reducing the
deallocation in this driver to nothing. I'll spin a new version.
Conversely, if I were to implement proper error handling here, I'd
convert it into a platform driver and use devm_* functions, because
dealing with all the little clock objects is just too painful and
fragile for my taste.
Thanks,
Jonathan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2023-04-22 15:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-15 11:13 [PATCH v6 0/2] Nuvoton WPCM450 clock and reset driver Jonathan Neuschäfer
2023-04-15 11:13 ` [PATCH v6 1/2] dt-bindings: clock: Add Nuvoton WPCM450 clock/reset controller Jonathan Neuschäfer
2023-04-15 11:13 ` [PATCH v6 2/2] clk: wpcm450: Add Nuvoton WPCM450 clock/reset controller driver Jonathan Neuschäfer
2023-04-15 12:16 ` Christophe JAILLET
2023-04-19 21:52 ` Jonathan Neuschäfer
2023-04-20 5:32 ` Christophe JAILLET
2023-04-22 15:56 ` Jonathan Neuschäfer [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=ZEQDsLYaRywV9IbF@probook \
--to=j.neuschaefer@gmx.net \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mturquette@baylibre.com \
--cc=openbmc@lists.ozlabs.org \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=tali.perry1@gmail.com \
--cc=tglx@linutronix.de \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=wim@linux-watchdog.org \
--cc=yuenn@google.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