Commit b06cd21e2f0f75686f95afa5b71219b1408f5458

Authored by Dan Carpenter
Committed by David Woodhouse
1 parent d2b5bbef21

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: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Showing 1 changed file with 4 additions and 8 deletions Side-by-side Diff

drivers/mtd/devices/m25p80.c
... ... @@ -347,8 +347,7 @@
347 347 spi_message_add_tail(&t[1], &m);
348 348  
349 349 /* Byte count starts at zero. */
350   - if (retlen)
351   - *retlen = 0;
  350 + *retlen = 0;
352 351  
353 352 mutex_lock(&flash->lock);
354 353  
... ... @@ -394,8 +393,7 @@
394 393 dev_name(&flash->spi->dev), __func__, "to",
395 394 (u32)to, len);
396 395  
397   - if (retlen)
398   - *retlen = 0;
  396 + *retlen = 0;
399 397  
400 398 /* sanity checks */
401 399 if (!len)
... ... @@ -466,8 +464,7 @@
466 464  
467 465 spi_sync(flash->spi, &m);
468 466  
469   - if (retlen)
470   - *retlen += m.actual_length - m25p_cmdsz(flash);
  467 + *retlen += m.actual_length - m25p_cmdsz(flash);
471 468 }
472 469 }
473 470  
... ... @@ -485,8 +482,7 @@
485 482 size_t actual;
486 483 int cmd_sz, ret;
487 484  
488   - if (retlen)
489   - *retlen = 0;
  485 + *retlen = 0;
490 486  
491 487 /* sanity checks */
492 488 if (!len)