summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorWeizhao Ouyang <[email protected]>2024-01-04 11:46:19 +0000
committerDario Binacchi <[email protected]>2024-04-14 08:49:39 +0200
commit85f3d3de8d3198f216dd3c146a6db6eae3cfff03 (patch)
treed52eb5d1aa4454ef654ae9b328f60959030a72ad /cmd
parent266603d8c39cf4d194e2cfe8d86d870590e150e0 (diff)
cmd: sf: Fix sf probe crash
Handle the return value of spi_flash_probe_bus_cs() to avoid sf probe crashes. Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Weizhao Ouyang <[email protected]> Reviewed-by: Michael Trimarchi <[email protected]> Acked-by: Michal Simek <[email protected]> Reviewed-by: Jonas Karlman <[email protected]> Signed-off-by: Dario Binacchi <[email protected]>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/sf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/sf.c b/cmd/sf.c
index 730996c02b7..e3866899f6c 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -135,8 +135,9 @@ static int do_spi_flash_probe(int argc, char *const argv[])
}
flash = NULL;
if (use_dt) {
- spi_flash_probe_bus_cs(bus, cs, &new);
- flash = dev_get_uclass_priv(new);
+ ret = spi_flash_probe_bus_cs(bus, cs, &new);
+ if (!ret)
+ flash = dev_get_uclass_priv(new);
} else {
flash = spi_flash_probe(bus, cs, speed, mode);
}