lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 06/21] eeprom: at24: drop redundant variable in at24_read()
    Date
    We can reuse ret instead of defining a loop-local status variable.

    Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
    ---
    drivers/misc/eeprom/at24.c | 14 ++++++--------
    1 file changed, 6 insertions(+), 8 deletions(-)

    diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
    index d1ad73d94fa8..ff7eb8e382c2 100644
    --- a/drivers/misc/eeprom/at24.c
    +++ b/drivers/misc/eeprom/at24.c
    @@ -392,17 +392,15 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
    mutex_lock(&at24->lock);

    while (count) {
    - int status;
    -
    - status = at24_regmap_read(at24, buf, off, count);
    - if (status < 0) {
    + ret = at24_regmap_read(at24, buf, off, count);
    + if (ret < 0) {
    mutex_unlock(&at24->lock);
    pm_runtime_put(dev);
    - return status;
    + return ret;
    }
    - buf += status;
    - off += status;
    - count -= status;
    + buf += ret;
    + off += ret;
    + count -= ret;
    }

    mutex_unlock(&at24->lock);
    --
    2.16.1
    \
     
     \ /
      Last update: 2018-03-19 10:28    [W:2.145 / U:0.120 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site