[PATCH] [FS] Print error message for unknown device type

Heiko Schocher hs at denx.de
Wed Jan 22 12:22:26 CET 2020


Hello Wolfgang,

Am 22.01.2020 um 12:08 schrieb Wolfgang Denk:
> 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 <wd at denx.de>
> ---
>   disk/part.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

Tested on wandboard.

Tested-by: Heiko Schocher <hs at denx.de>


> diff --git a/disk/part.c b/disk/part.c
> index 8982ef3bae..14000835c8 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -512,8 +512,10 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
>   
>   	/* Look up the device */
>   	dev = blk_get_device_by_str(ifname, dev_str, dev_desc);
> -	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.

>   
>   	/* Convert partition ID string to number */
>   	if (!part_str || !*part_str) {
> 

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list