[U-Boot] [PATCH 09/16] sf_mtd: Simply mtd operations

Boris Brezillon boris.brezillon at bootlin.com
Wed Dec 12 20:31:16 UTC 2018


On Wed, 12 Dec 2018 23:02:21 +0530
Vignesh R <vigneshr at ti.com> wrote:

> @@ -39,13 +37,12 @@ static int spi_flash_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
>  static int spi_flash_mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
>  	size_t *retlen, u_char *buf)
>  {
> -	struct spi_flash *flash = mtd->priv;
>  	int err;
>  
> -	if (!flash)
> +	if (!mtd || !mtd->priv)
>  		return -ENODEV;
>  
> -	err = spi_flash_read(flash, from, len, buf);
> +	err = mtd->_read(mtd, from, len, retlen, buf);

Please use the wrappers instead of calling those hooks directly.


More information about the U-Boot mailing list