mtd: move zero length verification to MTD API functions
In many places in drivers we verify for the zero length, but this is very inconsistent across drivers. This is obviously the right thing to do, though. This patch moves the check to the MTD API functions instead and removes a lot of duplication. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:

committed by
David Woodhouse

parent
0dd5235f51
commit
bcb1d23871
@@ -220,10 +220,6 @@ static int sst25l_read(struct mtd_info *mtd, loff_t from, size_t len,
|
||||
unsigned char command[4];
|
||||
int ret;
|
||||
|
||||
/* Sanity checking */
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
spi_message_init(&message);
|
||||
memset(&transfer, 0, sizeof(transfer));
|
||||
|
||||
@@ -265,10 +261,6 @@ static int sst25l_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
int i, j, ret, bytes, copied = 0;
|
||||
unsigned char command[5];
|
||||
|
||||
/* Sanity checks */
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
if ((uint32_t)to % mtd->writesize)
|
||||
return -EINVAL;
|
||||
|
||||
|
Reference in New Issue
Block a user