Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AFBEEC144C for ; Tue, 3 Mar 2026 13:38:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D965E83F64; Tue, 3 Mar 2026 14:38:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4F13683E7F; Tue, 3 Mar 2026 14:38:33 +0100 (CET) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [IPv6:2a07:2ec0:3002::65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0F2CC83F63 for ; Tue, 3 Mar 2026 14:38:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=daniel@makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1vxPwy-000000004s1-0v5M; Tue, 03 Mar 2026 13:38:12 +0000 Date: Tue, 3 Mar 2026 13:38:03 +0000 From: Daniel Golle To: Christian Marangi Cc: Tom Rini , Simon Glass , Casey Connolly , Peng Fan , Quentin Schulz , Harsha Vardhan V M , Neha Malcom Francis , Chen-Yu Tsai , Jamie Gibbons , Justin Klaassen , Leo Yu-Chi Liang , Weijie Gao , Marek Vasut , "Lucien.Jheng" , Sky Huang , Alif Zakuan Yuslaimi , u-boot@lists.denx.de Subject: Re: [PATCH 1/5] misc: fs_loader: fix ubifs not unmounted on dev_get_priv error Message-ID: References: <20260303132916.5502-1-ansuelsmth@gmail.com> <20260303132916.5502-2-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260303132916.5502-2-ansuelsmth@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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. > > 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 > --- > 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 >