]> git.ipfire.org Git - thirdparty/u-boot.git/commit
cmd: mmc: Check whether arguments are valid numbers in dev subcommand
authorYao Zi <me@ziyao.cc>
Fri, 30 Jan 2026 18:03:52 +0000 (18:03 +0000)
committerPeng Fan <peng.fan@nxp.com>
Tue, 3 Feb 2026 14:11:45 +0000 (22:11 +0800)
commitf955e00e42e9b7ef5a3adf1ba1947f46c05a3d36
tree1b38c1159640c2a7b848755ebba45833ecd81520
parent97cc26f6b6a85312305e5b953ef44861891936bf
cmd: mmc: Check whether arguments are valid numbers in dev subcommand

Currently when any of speed_mode, part, or dev fails to be parse as a
number, no error is reported. In this case __init_mmc_device() is called
with weird arguments, probably zeroes if there's no digit prefixing the
argument, which is especially confusing when the invocation occasionally
succeeds.

Let's check whether arguments are valid numbers without trailing
characters. This is quite helpful for speed_mode: it requires an index
instead of a mode name, one may easily pass in a string, which will be
parsed as zero (MMC_LEGACY), without carefully reading the
documentation, then finds the MMC device is under an unexpected mode.

Signed-off-by: Yao Zi <me@ziyao.cc>
Tested-by: Anshul Dalal <anshuld@ti.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
cmd/mmc.c