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

Commit 0ea18011 authored by Deepak Katragadda's avatar Deepak Katragadda
Browse files

soc: qcom: ssr: Correct the returned value of device attribute functions



The value being returned by the SSR store attributes operations
is lesser than the length of the buffer being passed in. As a
result, the operation keeps getting called again in an infinite
loop. Correct this returned value.

Change-Id: I8612b63ee7daae269ca53a4ee9f5213df014b638
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent a820922f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -220,8 +220,8 @@ static ssize_t restart_level_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	struct subsys_device *subsys = to_subsys(dev);
	int i;
	const char *p;
	int i, orig_count = count;

	p = memchr(buf, '\n', count);
	if (p)
@@ -230,7 +230,7 @@ static ssize_t restart_level_store(struct device *dev,
	for (i = 0; i < ARRAY_SIZE(restart_levels); i++)
		if (!strncasecmp(buf, restart_levels[i], count)) {
			subsys->restart_level = i;
			return count;
			return orig_count;
		}
	return -EPERM;
}
@@ -247,18 +247,17 @@ static ssize_t firmware_name_store(struct device *dev,
	struct subsys_device *subsys = to_subsys(dev);
	struct subsys_tracking *track = subsys_get_track(subsys);
	const char *p;
	int orig_count = count;

	p = memchr(buf, '\n', count);
	if (p)
		count = p - buf;
	if (!count)
		return -EPERM;

	pr_info("Changing subsys fw_name to %s\n", buf);
	mutex_lock(&track->lock);
	strlcpy(subsys->desc->fw_name, buf, count + 1);
	mutex_unlock(&track->lock);
	return count;
	return orig_count;
}

static ssize_t system_debug_show(struct device *dev,
@@ -279,6 +278,7 @@ static ssize_t system_debug_store(struct device *dev,
{
	struct subsys_device *subsys = to_subsys(dev);
	const char *p;
	int orig_count = count;

	p = memchr(buf, '\n', count);
	if (p)
@@ -290,7 +290,7 @@ static ssize_t system_debug_store(struct device *dev,
		subsys->desc->system_debug = false;
	else
		return -EPERM;
	return count;
	return orig_count;
}

int subsys_get_restart_level(struct subsys_device *dev)