Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fb3d279 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

power: supply: ab8500_fg: silence uninitialized variable warnings



[ Upstream commit 54baff8d4e5dce2cef61953b1dc22079cda1ddb1 ]

If kstrtoul() fails then we print "charge_full" when it's uninitialized.
The debug printk doesn't add anything so I deleted it and cleaned these
two functions up a bit.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c9398259
Loading
Loading
Loading
Loading
+12 −19
Original line number Diff line number Diff line
@@ -2433,17 +2433,14 @@ static ssize_t charge_full_store(struct ab8500_fg *di, const char *buf,
				 size_t count)
{
	unsigned long charge_full;
	ssize_t ret;
	int ret;

	ret = kstrtoul(buf, 10, &charge_full);
	if (ret)
		return ret;

	dev_dbg(di->dev, "Ret %zd charge_full %lu", ret, charge_full);

	if (!ret) {
	di->bat_cap.max_mah = (int) charge_full;
		ret = count;
	}
	return ret;
	return count;
}

static ssize_t charge_now_show(struct ab8500_fg *di, char *buf)
@@ -2455,20 +2452,16 @@ static ssize_t charge_now_store(struct ab8500_fg *di, const char *buf,
				 size_t count)
{
	unsigned long charge_now;
	ssize_t ret;
	int ret;

	ret = kstrtoul(buf, 10, &charge_now);
	if (ret)
		return ret;

	dev_dbg(di->dev, "Ret %zd charge_now %lu was %d",
		ret, charge_now, di->bat_cap.prev_mah);

	if (!ret) {
	di->bat_cap.user_mah = (int) charge_now;
	di->flags.user_cap = true;
		ret = count;
	queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0);
	}
	return ret;
	return count;
}

static struct ab8500_fg_sysfs_entry charge_full_attr =