From: Daniel Golle <daniel@makrotopia.org>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
Casey Connolly <casey.connolly@linaro.org>,
Peng Fan <peng.fan@nxp.com>,
Quentin Schulz <quentin.schulz@cherry.de>,
Harsha Vardhan V M <h-vm@ti.com>,
Neha Malcom Francis <n-francis@ti.com>,
Chen-Yu Tsai <wens@kernel.org>,
Jamie Gibbons <jamie.gibbons@microchip.com>,
Justin Klaassen <justin@tidylabs.net>,
Leo Yu-Chi Liang <ycliang@andestech.com>,
Weijie Gao <weijie.gao@mediatek.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
"Lucien.Jheng" <lucienzx159@gmail.com>,
Sky Huang <SkyLake.Huang@mediatek.com>,
Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH 1/5] misc: fs_loader: fix ubifs not unmounted on dev_get_priv error
Date: Tue, 3 Mar 2026 13:53:16 +0000 [thread overview]
Message-ID: <aabnzMx4LPEl-mjk@makrotopia.org> (raw)
In-Reply-To: <69a6e585.050a0220.1492ea.9245@mx.google.com>
On Tue, Mar 03, 2026 at 02:43:29PM +0100, Christian Marangi wrote:
> On Tue, Mar 03, 2026 at 01:38:03PM +0000, Daniel Golle wrote:
> > On Tue, Mar 03, 2026 at 02:29:08PM +0100, Christian Marangi wrote:
> > > When dev_get_priv errors out, the ubifs is not unbounted (if used)
> >
> > I don't understand why or where UBIFS is being used here.
> > Did you mean to say "UBI is not attached"?
> > UBI != UBIFS.
> >
>
> Function that is not called is umount_ubifs. That calls cmd_ubifs_umount.
> unbounted is a typo for unmounted.
Ok, so it *is* UBIFS, because you cannot mount UBI. You can only
"attach" an MTD partition to serve as UBI device (`ubi part ...` command
in U-Boot).
>
> Probably the confusion is present already in the FS loader driver where ubi
> needed to be used instead of ubifs?
If you are loading a file from a directory and rely on full POSIX-like
permissions, file ownership, ... then you need a proper filesystem, like
UBIFS, or SquashFS, ...
If all you need is to load raw data early at boot, using a static UBI
volume to hold the raw data is probably better (see below).
>
> There are mount_ubifs and umount_ubifs but they should have been mount_ubi and
> umount_ubi ? But then they use ubifs cmd OPs. I'm a bit confused here.
UBIFS is a read/write filesystem used on top of UBI.
UBI is a bit like a light version of LVM2, you can have multiple named
volumes, dynamically create them, rename or resize them.
Volumes can be static (ie. write-once, CRC32 over the whole volume
which is validated on access) or dynamic (no CRC validation, content
may change).
Inside dynamic volumes you may have either a filesystem or just raw
data. Any read-only filesystem can be used on top of UBI with the help
of ubiblock devices (eg. squashfs, erofs, ...).
In static volumes you typically store raw data, like it is the case
for U-Boot SPL loading U-Boot proper from UBI requires u-boot.bin
stored in a raw static volume, **not** inside a filesystem).
Imho using static volumes also makes a lot of sense for storing
those PHY or Ethernet firmware blobs, potentially even storing them
redundantly (ie. two static volumes, if one got broken CRC, move on
to the next one).
>
> > >
> > > Correctly handle this handle condition and while at it also return -EINVAL
> > > instead of -ENOMEM as a better error since no memory is allocated but is
> > > actually an invalid scenario for fw_get_filesystem_firmware().
> > >
> > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > > ---
> > > drivers/misc/fs_loader.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
> > > index 2928cf75f89e..7e432a7ebd62 100644
> > > --- a/drivers/misc/fs_loader.c
> > > +++ b/drivers/misc/fs_loader.c
> > > @@ -178,8 +178,10 @@ static int fw_get_filesystem_firmware(struct udevice *dev)
> > >
> > > struct firmware *firmwarep = dev_get_priv(dev);
> > >
> > > - if (!firmwarep)
> > > - return -ENOMEM;
> > > + if (!firmwarep) {
> > > + ret = -EINVAL;
> > > + goto out;
> > > + }
> > >
> > > ret = fs_read(firmwarep->name, (ulong)map_to_sysmem(firmwarep->data),
> > > firmwarep->offset, firmwarep->size, &actread);
> > > --
> > > 2.51.0
> > >
>
> --
> Ansuel
next prev parent reply other threads:[~2026-03-03 13:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 13:29 [PATCH 0/5] misc: fs_loader: reorg and split to FS and FW loader + FIP loader Christian Marangi
2026-03-03 13:29 ` [PATCH 1/5] misc: fs_loader: fix ubifs not unmounted on dev_get_priv error Christian Marangi
2026-03-03 13:38 ` Daniel Golle
2026-03-03 13:43 ` Christian Marangi
2026-03-03 13:53 ` Daniel Golle [this message]
2026-03-03 13:29 ` [PATCH 2/5] misc: fs_loader: reorganize and split to FS and FW loader Christian Marangi
2026-03-03 13:29 ` [PATCH 3/5] misc: fw_loader: implement generic get_fw_loader_from_node() Christian Marangi
2026-03-03 13:29 ` [PATCH 4/5] misc: fw_loader: introduce FIP loader driver Christian Marangi
2026-03-03 13:29 ` [PATCH 5/5] misc: fw_loader: implement request_firmware_size() OP Christian Marangi
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=aabnzMx4LPEl-mjk@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=SkyLake.Huang@mediatek.com \
--cc=alif.zakuan.yuslaimi@altera.com \
--cc=ansuelsmth@gmail.com \
--cc=casey.connolly@linaro.org \
--cc=h-vm@ti.com \
--cc=jamie.gibbons@microchip.com \
--cc=justin@tidylabs.net \
--cc=lucienzx159@gmail.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=n-francis@ti.com \
--cc=peng.fan@nxp.com \
--cc=quentin.schulz@cherry.de \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=weijie.gao@mediatek.com \
--cc=wens@kernel.org \
--cc=ycliang@andestech.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