提交 c4fee330 编写于 作者: B Bartosz Golaszewski 提交者: Greg Kroah-Hartman

eeprom: at24: drop redundant variable in at24_write()

We can reuse ret instead of defining a loop-local status variable.
Signed-off-by: NBartosz Golaszewski <brgl@bgdev.pl>
Tested-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 eb27fde2
......@@ -443,18 +443,16 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
gpiod_set_value_cansleep(at24->wp_gpio, 0);
while (count) {
int status;
status = at24_regmap_write(at24, buf, off, count);
if (status < 0) {
ret = at24_regmap_write(at24, buf, off, count);
if (ret < 0) {
gpiod_set_value_cansleep(at24->wp_gpio, 1);
mutex_unlock(&at24->lock);
pm_runtime_put(dev);
return status;
return ret;
}
buf += status;
off += status;
count -= status;
buf += ret;
off += ret;
count -= ret;
}
gpiod_set_value_cansleep(at24->wp_gpio, 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部