Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297326

[PATCH] cpufreq/scpi: fix handling return value of topology_physical_package_id

From Andrzej Hajda <a.hajda@samsung.com>
Newsgroups linux.kernel
Subject [PATCH] cpufreq/scpi: fix handling return value of topology_physical_package_id
Date 2015-12-23 11:40 +0100
Message-ID <qIOZP-8qJ-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/cpufreq/scpi-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
index 2c3b16f..de5e89b 100644
--- a/drivers/cpufreq/scpi-cpufreq.c
+++ b/drivers/cpufreq/scpi-cpufreq.c
@@ -31,7 +31,7 @@ static struct scpi_ops *scpi_ops;
 
 static struct scpi_dvfs_info *scpi_get_dvfs_info(struct device *cpu_dev)
 {
-	u8 domain = topology_physical_package_id(cpu_dev->id);
+	int domain = topology_physical_package_id(cpu_dev->id);
 
 	if (domain < 0)
 		return ERR_PTR(-EINVAL);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] cpufreq/scpi: fix handling return value of  topology_physical_package_id Andrzej Hajda <a.hajda@samsung.com> - 2015-12-23 11:40 +0100
  [PATCH] pinctrl: nsp-gpio: fix type of iterator Andrzej Hajda <a.hajda@samsung.com> - 2015-12-23 11:40 +0100
    Re: [PATCH] pinctrl: nsp-gpio: fix type of iterator Ray Jui <rjui@broadcom.com> - 2015-12-23 23:40 +0100
      Re: [PATCH] pinctrl: nsp-gpio: fix type of iterator Yendapally Reddy Dhananjaya Reddy <yrdreddy@broadcom.com> - 2015-12-24 06:40 +0100
    Re: [PATCH] pinctrl: nsp-gpio: fix type of iterator Linus Walleij <linus.walleij@linaro.org> - 2015-12-24 10:10 +0100
  [PATCH] NFC: nci: fix handling return value of nci_hci_create_pipe Andrzej Hajda <a.hajda@samsung.com> - 2015-12-23 11:40 +0100
  Re: [PATCH] cpufreq/scpi: fix handling return value of  topology_physical_package_id Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-23 11:50 +0100
  Re: [PATCH] cpufreq/scpi: fix handling return value of  topology_physical_package_id Sudeep Holla <sudeep.holla@arm.com> - 2015-12-23 11:50 +0100

csiph-web