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>
Цей коміт міститься в:

зафіксовано
David Woodhouse

джерело
0dd5235f51
коміт
bcb1d23871
@@ -1246,9 +1246,6 @@ static int cfi_amdstd_write_words(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
unsigned long ofs, chipstart;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
chipnum = to >> cfi->chipshift;
|
||||
ofs = to - (chipnum << cfi->chipshift);
|
||||
chipstart = cfi->chips[chipnum].start;
|
||||
@@ -1487,9 +1484,6 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
int chipnum;
|
||||
unsigned long ofs;
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
chipnum = to >> cfi->chipshift;
|
||||
ofs = to - (chipnum << cfi->chipshift);
|
||||
|
||||
@@ -1697,9 +1691,6 @@ static int cfi_amdstd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
int ret = 0;
|
||||
int chipnum;
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
chipnum = to >> cfi->chipshift;
|
||||
ofs = to - (chipnum << cfi->chipshift);
|
||||
chipstart = cfi->chips[chipnum].start;
|
||||
|
Посилання в новій задачі
Заблокувати користувача