[PATCH v2] cmd: Ensure sf operates on spi flash

Bin Meng bmeng.cn at gmail.com
Tue Feb 4 11:49:19 CET 2020


Hi Sean,

On Mon, Jan 20, 2020 at 7:13 AM Sean Anderson <seanga2 at gmail.com> wrote:
>
> Currently, the sf command will probe anything attached to an spi bus, regardless
> of whether it is UCLASS_SPI_FLASH. This came up when testing the mmc_spi driver,

Did you do something like:

=> sf probe 1 0

?

> which is accessed via spi but is UCLASS_MMC. If the uclass is not what sf
> expects, then the "flash" variable will not actually have type spi_nor. This
> patch adds a check so we don't clobber any data if the user requests us to probe
> a device which is not an spi flash.
>
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
> Changes for v2:
>   Fixed Signed-off-by line
>   Fix typo (SPU_FLASH -> SPI_FLASH)
>
>  cmd/sf.c | 4 ++++
>  1 file changed, 4 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

Regards,
Bin


More information about the U-Boot mailing list