diff options
| author | Weizhao Ouyang <[email protected]> | 2024-01-04 11:46:19 +0000 |
|---|---|---|
| committer | Dario Binacchi <[email protected]> | 2024-04-14 08:49:39 +0200 |
| commit | 85f3d3de8d3198f216dd3c146a6db6eae3cfff03 (patch) | |
| tree | d52eb5d1aa4454ef654ae9b328f60959030a72ad /cmd | |
| parent | 266603d8c39cf4d194e2cfe8d86d870590e150e0 (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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); } |
