Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b06cd21e authored by Dan Carpenter's avatar Dan Carpenter Committed by David Woodhouse
Browse files

mtd/m25p80: retlen is never NULL

This is just a cleanup, it doesn't fix any bugs.

These functions all check retlen inconsistently and it generates a
warning in Smatch (http://smatch.sf.net

).  If retlen were ever NULL it
would cause an oops and the code has been this way since 2006 so someone
would have complained.  Also I looked at other places that implemented
the mtd read and write functions and they dereference retlen without
checking.

I removed the checks.

Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent d2b5bbef
Loading
Loading
Loading
Loading
+4 −8
Original line number Original line Diff line number Diff line
@@ -347,7 +347,6 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
	spi_message_add_tail(&t[1], &m);
	spi_message_add_tail(&t[1], &m);


	/* Byte count starts at zero. */
	/* Byte count starts at zero. */
	if (retlen)
	*retlen = 0;
	*retlen = 0;


	mutex_lock(&flash->lock);
	mutex_lock(&flash->lock);
@@ -394,7 +393,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
			dev_name(&flash->spi->dev), __func__, "to",
			dev_name(&flash->spi->dev), __func__, "to",
			(u32)to, len);
			(u32)to, len);


	if (retlen)
	*retlen = 0;
	*retlen = 0;


	/* sanity checks */
	/* sanity checks */
@@ -466,7 +464,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,


			spi_sync(flash->spi, &m);
			spi_sync(flash->spi, &m);


			if (retlen)
			*retlen += m.actual_length - m25p_cmdsz(flash);
			*retlen += m.actual_length - m25p_cmdsz(flash);
		}
		}
	}
	}
@@ -485,7 +482,6 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
	size_t actual;
	size_t actual;
	int cmd_sz, ret;
	int cmd_sz, ret;


	if (retlen)
	*retlen = 0;
	*retlen = 0;


	/* sanity checks */
	/* sanity checks */