From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Robert Marko" <robert.marko@sartura.hr>,
"Luka Perkov" <luka.perkov@sartura.hr>,
"Michael Walle" <michael@walle.cc>,
linux-kernel@vger.kernel.org,
"Randy Dunlap" <rdunlap@infradead.org>,
"Chen-Yu Tsai" <wenst@chromium.org>,
"Daniel Golle" <daniel@makrotopia.org>,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH v9 1/7] nvmem: core: Create all cells before adding the nvmem device
Date: Fri, 11 Aug 2023 14:38:21 +0200 [thread overview]
Message-ID: <20230811143821.29cf335a@xps-13> (raw)
In-Reply-To: <154883fc-a6bc-01a9-b044-dac8848e9963@linaro.org>
Hi Srinivas,
srinivas.kandagatla@linaro.org wrote on Fri, 11 Aug 2023 13:26:24 +0100:
> On 11/08/2023 13:11, Miquel Raynal wrote:
>
> >>
> >>
> >
> > nvmem_register() calls device_initialize() and later device_add(),
> > which is exactly the content of device_register(). Upon error
> > after device_add(), we currently call device_put(), whereas
> > device_unregister would call both device_del() and device_put().
> >
> > I would expect device_del() to be first called upon error before
> > device_put() *after* device_add() has succeded, no?
>
> That is correct afaiu, if device_add is succeed we need to call device_del(). As the patch now moved the device_add to end of function we really do not need device_del() in err path.
Right, I'm looking at the end of the series where I need to add
device_del() in the error path because something gets added after
device_add(). So we are aligned, thanks for the feedback.
> >>> I also see the layout_np below should be freed before jumping in the
> >>> error section.
> >>
> >> you mean missing of_node_put()?
> >
> > Yes, I need to call of_node_put() before jumping into the error path.
>
> Are we not already doing it in nvmem_layout_get() and nvmem_add_cells_from_fixed_layout() ?
We perform the layout_get for two reasons:
- knowing if there is a layout
- using the layout
Here we are in the first case, and we don't want to retain a reference
from here. Only in the second case.
Thanks,
Miquèl
next prev parent reply other threads:[~2023-08-11 12:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 6:29 [PATCH v9 0/7] NVMEM cells in sysfs Miquel Raynal
2023-08-08 6:29 ` [PATCH v9 1/7] nvmem: core: Create all cells before adding the nvmem device Miquel Raynal
2023-08-08 6:37 ` Michael Walle
2023-08-08 6:56 ` Srinivas Kandagatla
2023-08-08 7:24 ` Miquel Raynal
2023-08-11 11:11 ` Srinivas Kandagatla
2023-08-11 12:11 ` Miquel Raynal
2023-08-11 12:26 ` Srinivas Kandagatla
2023-08-11 12:38 ` Miquel Raynal [this message]
2023-08-08 6:29 ` [PATCH v9 2/7] nvmem: core: Return NULL when no nvmem layout is found Miquel Raynal
2023-08-08 6:38 ` Michael Walle
2023-08-08 6:29 ` [PATCH v9 3/7] nvmem: core: Do not open-code existing functions Miquel Raynal
2023-08-08 6:41 ` Michael Walle
2023-08-08 6:29 ` [PATCH v9 4/7] nvmem: core: Notify when a new layout is registered Miquel Raynal
2023-08-08 6:29 ` [PATCH v9 5/7] nvmem: core: Rework layouts to become platform devices Miquel Raynal
2023-08-08 6:29 ` [PATCH v9 6/7] ABI: sysfs-nvmem-cells: Expose cells through sysfs Miquel Raynal
2023-08-08 6:29 ` [PATCH v9 7/7] nvmem: core: " Miquel Raynal
2023-08-14 10:01 ` (subset) [PATCH v9 0/7] NVMEM cells in sysfs Srinivas Kandagatla
2023-08-17 9:06 ` Miquel Raynal
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=20230811143821.29cf335a@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=daniel@makrotopia.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luka.perkov@sartura.hr \
--cc=michael@walle.cc \
--cc=rafal@milecki.pl \
--cc=rdunlap@infradead.org \
--cc=robert.marko@sartura.hr \
--cc=srinivas.kandagatla@linaro.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wenst@chromium.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 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.