From: Weizhao Ouyang Date: Thu, 4 Jan 2024 11:46:19 +0000 (+0000) Subject: cmd: sf: Fix sf probe crash X-Git-Url: http://git.dujemihanovic.xyz/img/static/%7B%7B%20%24.Site.BaseURL%20%7D%7Dposts/index.xml?a=commitdiff_plain;h=85f3d3de8d3198f216dd3c146a6db6eae3cfff03;p=u-boot.git 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/20240104114619.280513-1-o451686892@gmail.com Signed-off-by: Weizhao Ouyang Reviewed-by: Michael Trimarchi Acked-by: Michal Simek Reviewed-by: Jonas Karlman Signed-off-by: Dario Binacchi --- diff --git a/cmd/sf.c b/cmd/sf.c index 730996c02b..e3866899f6 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); }