public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: Error handling broken for block devices
Date: Mon, 20 Jan 2020 17:40:56 +0100	[thread overview]
Message-ID: <20200120164056.448EB24004C@gemini.denx.de> (raw)

Hi,

I noticed that block device commands like "ls" fail to give any error
messages in some cases.  For example, something like

	-> ls FOOBAR 1:1 /
	->

will terminate without the slightest hint that FOOBAR is some device
type it does not know.

Following the call chain I see this:

"ls" command -> do_ls (...) -> fs_set_blk_dev(...) -> blk_get_device_part_str()

"disk/part.c":

431 int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
432                              struct blk_desc **dev_desc,
433                              disk_partition_t *info, int allow_whole_dev)
...
450         if (0 == strcmp(ifname, "hostfs")) {
...
466         }
...
474         if (0 == strcmp(ifname, "ubi")) {
...
488         }
513         /* Look up the device */
514         dev = blk_get_device_by_str(ifname, dev_str, dev_desc);
515         if (dev < 0)
516                 goto cleanup;

No error messages get printed here, but I think these are mandatory
in such a case.


Stephen, this code was added as part of your commit:

commit 10a37fd7a40826c43a63591855346adf1a1ac02d
Author: Stephen Warren <swarren@nvidia.com>
Date:   Fri Sep 21 09:50:57 2012 +0000

    disk: get_device_and_partition() "auto" partition and cleanup


Can you think of any strong reason _not_ to issue a proper error
message here?

[From the user perspective it would also be nice to have a way to
find out which device types are actually supported in a given U-Boot
binary.  Or is there such a tool?]

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
It's not an optical illusion, it just looks like one.   -- Phil White

             reply	other threads:[~2020-01-20 16:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 16:40 Wolfgang Denk [this message]
2020-01-20 20:16 ` Error handling broken for block devices Stephen Warren

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=20200120164056.448EB24004C@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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