U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	Mattijs Korpershoek <mkorpershoek@kernel.org>,
	Heiko Schocher <hs@nabladev.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Dinesh Maniyam <dinesh.maniyam@altera.com>,
	Martin Schwan <m.schwan@phytec.de>,
	"Markus Schneider-Pargmann (TI.com)" <msp@baylibre.com>,
	"Lucien.Jheng" <lucienzx159@gmail.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Michal Simek <michal.simek@amd.com>,
	Casey Connolly <casey.connolly@linaro.org>,
	Peng Fan <peng.fan@nxp.com>,
	Mateus Lima Alves <mateuslima.ti@gmail.com>,
	Neha Malcom Francis <n-francis@ti.com>,
	Jamie Gibbons <jamie.gibbons@microchip.com>,
	Leo Yu-Chi Liang <ycliang@andestech.com>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	Weijie Gao <weijie.gao@mediatek.com>,
	Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>,
	Sky Huang <SkyLake.Huang@mediatek.com>, Randolph Sapp <rs@ti.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	u-boot@lists.denx.de
Subject: [PATCH v7 1/7] misc: fs_loader: fix ubifs not unmounted on dev_get_priv error
Date: Tue, 16 Jun 2026 21:18:36 +0200	[thread overview]
Message-ID: <20260616191845.6182-2-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20260616191845.6182-1-ansuelsmth@gmail.com>

When dev_get_priv errors out, the ubifs is not umounted (if used).

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>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Neha Malcom Francis <n-francis@ti.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 6af4c7f15e7b..cd4695b08eea 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -175,8 +175,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.53.0


  reply	other threads:[~2026-06-16 19:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 19:18 [PATCH v7 0/7] misc: fs_loader: reorg and split to FS and FW loader + FIP loader Christian Marangi
2026-06-16 19:18 ` Christian Marangi [this message]
2026-06-16 19:18 ` [PATCH v7 2/7] misc: fs_loader: reorganize and split to FS loader and FW UCLASS Christian Marangi
2026-06-16 19:18 ` [PATCH v7 3/7] misc: fw_loader: implement generic get_fw_loader_from_node() Christian Marangi
2026-06-16 19:18 ` [PATCH v7 4/7] misc: fw_loader: implement request_firmware_size() OP Christian Marangi
2026-06-16 19:18 ` [PATCH v7 5/7] misc: fw_loader: introduce FIP loader driver Christian Marangi
2026-06-16 19:18 ` [PATCH v7 6/7] doc: dtbinding: Update documentation for Generic Firmware loader Christian Marangi
2026-06-16 19:18 ` [PATCH v7 7/7] test: dm: Add test for FW Loader feature 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=20260616191845.6182-2-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=SkyLake.Huang@mediatek.com \
    --cc=alif.zakuan.yuslaimi@altera.com \
    --cc=casey.connolly@linaro.org \
    --cc=dinesh.maniyam@altera.com \
    --cc=hs@nabladev.com \
    --cc=jamie.gibbons@microchip.com \
    --cc=lucienzx159@gmail.com \
    --cc=m.schwan@phytec.de \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mateuslima.ti@gmail.com \
    --cc=michal.simek@amd.com \
    --cc=mkorpershoek@kernel.org \
    --cc=msp@baylibre.com \
    --cc=n-francis@ti.com \
    --cc=neil.armstrong@linaro.org \
    --cc=peng.fan@nxp.com \
    --cc=quentin.schulz@cherry.de \
    --cc=rs@ti.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    --cc=xypron.glpk@gmx.de \
    --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