From: Wolfgang Denk Date: Wed, 22 Jan 2020 13:12:53 +0100 Subject: [PATCH] [FS] Print error message for unknown device type In-Reply-To: <3546d28c-f638-5357-a20f-5d03db762be0@denx.de> References: <20200122110852.2741617-1-wd@denx.de> <3546d28c-f638-5357-a20f-5d03db762be0@denx.de> Message-ID: <20200122121253.7B0B3240638@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Heiko, In message <3546d28c-f638-5357-a20f-5d03db762be0@denx.de> you wrote: > > > File system commands like "ls" etc. require a device type parameter. > > If an unknown type is specified, they return an error code but no > > visible feedback to the user: > > > > -> ls FOOBAR 1:1 / > > -> > > > > Add an error message to make clear what happens, and why. > > > > Signed-off-by: Wolfgang Denk > > --- > > disk/part.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > Tested on wandboard. > > Tested-by: Heiko Schocher Thanks for testing. > > - if (dev < 0) > > + if (dev < 0) { > > + printf("** Unknown device type %s **\n", ifname); > > goto cleanup; > > + } > > It would be nice to have here a list of supported devices, so a user > can see what are valid arguments for ifname. Yes, you are absolutely right. I aready thought about this, but I have to admit that I got stuck in the code; there are several complexities - code for example for blk_driver_lookup_typename() is duplicated both in drivers/block/blk_legacy.c and in drivers/block/blk-uclass.c; I was not able to find any exported interface that actually allows to get a list of supported device drivers, and the things I tried all looked really ugly to me. Adding Simon to Cc: - he has designed and written all this code and should know better. Simon, what would be a clean and elegant approach to get such a list of supported drivers ? In any case I recommend to accept this patch as is; this other thing is additional information that can /should get added later in a spearate patch. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de People don't like to be lectured to, but if you can make them laugh, their defenses come down, and for the time being they've accepted whatever truth is embedded in your humor. - Paul Krassner