diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-02-06 06:27:43 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-26 19:32:19 -0400 |
commit | bcb1d238716d138c9e16347fc32b3c1ae006339e (patch) | |
tree | ccb7a9aea7b77481fa3474124218521e0c32de82 /drivers/mtd/devices/sst25l.c | |
parent | 0dd5235f51fb0eb0b8cef3fed35be39b8a06d7bd (diff) |
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>
Diffstat (limited to 'drivers/mtd/devices/sst25l.c')
-rw-r--r-- | drivers/mtd/devices/sst25l.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c index 5c2613c99e4a..51b2df33b8e9 100644 --- a/drivers/mtd/devices/sst25l.c +++ b/drivers/mtd/devices/sst25l.c | |||
@@ -220,10 +220,6 @@ static int sst25l_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
220 | unsigned char command[4]; | 220 | unsigned char command[4]; |
221 | int ret; | 221 | int ret; |
222 | 222 | ||
223 | /* Sanity checking */ | ||
224 | if (len == 0) | ||
225 | return 0; | ||
226 | |||
227 | spi_message_init(&message); | 223 | spi_message_init(&message); |
228 | memset(&transfer, 0, sizeof(transfer)); | 224 | memset(&transfer, 0, sizeof(transfer)); |
229 | 225 | ||
@@ -265,10 +261,6 @@ static int sst25l_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
265 | int i, j, ret, bytes, copied = 0; | 261 | int i, j, ret, bytes, copied = 0; |
266 | unsigned char command[5]; | 262 | unsigned char command[5]; |
267 | 263 | ||
268 | /* Sanity checks */ | ||
269 | if (!len) | ||
270 | return 0; | ||
271 | |||
272 | if ((uint32_t)to % mtd->writesize) | 264 | if ((uint32_t)to % mtd->writesize) |
273 | return -EINVAL; | 265 | return -EINVAL; |
274 | 266 | ||