From patchwork Wed Dec 23 10:37:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7910081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CA683BEEE5 for ; Wed, 23 Dec 2015 10:40:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0653B2045B for ; Wed, 23 Dec 2015 10:40:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3182C20411 for ; Wed, 23 Dec 2015 10:40:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aBgpH-0006rO-PS; Wed, 23 Dec 2015 10:39:23 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aBgpE-0006cP-F3 for linux-arm-kernel@lists.infradead.org; Wed, 23 Dec 2015 10:39:21 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NZT00BJY48V2JB0@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 23 Dec 2015 10:38:55 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-b4-567a79bf37fd Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id FD.72.21385.FB97A765; Wed, 23 Dec 2015 10:38:55 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NZT008TT48PPY50@eusync2.samsung.com>; Wed, 23 Dec 2015 10:38:55 +0000 (GMT) From: Andrzej Hajda To: Sudeep Holla Subject: [PATCH] cpufreq/scpi: fix handling return value of topology_physical_package_id Date: Wed, 23 Dec 2015 11:37:18 +0100 Message-id: <1450867041-729-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupiluLIzCtJLcpLzFFi42I5/e/4Fd39lVVhBhe7JSxurTvHarFxxnpW i02Pr7FaXN41h83ic+8RRou1R+6yW5w5fYnVYvmpHSwWG796OHB6rJm3htHjzrU9bB6bl9R7 bLnazuLRt2UVo8fnTXIBbFFcNimpOZllqUX6dglcGQ+vb2MuWM5e8fvRIeYGxvlsXYycHBIC JhKvz+5mhrDFJC7cWw8U5+IQEljKKHF8cy8LhNPEJNFxexEjSBWbgKbE3803wbpFBNQllpzd wghSxCywjVli6eJJYEXCAlESKzf1sYDYLAKqEp9etIHFeQUcJTY82skIsU5O4uSxyawTGLkX MDKsYhRNLU0uKE5KzzXSK07MLS7NS9dLzs/dxAgJoa87GJceszrEKMDBqMTD+6K5MkyINbGs uDL3EKMEB7OSCG/6O6AQb0piZVVqUX58UWlOavEhRmkOFiVx3pm73ocICaQnlqRmp6YWpBbB ZJk4OKUaGI/9fCs+u6f/jVGF67GLE2+JuB3n8LXUdW9JbggXOc2hM1/u4K9/5tdlj3Eeb1CP ZxBRm/ziQGX7+qpnZTMWfGfK++pd4jNfuG6z8Eu7s0lvL7F13350Q4bZL/fWh5TbjfVac0+E MMy+P0t749v2Bbpmu0tnmk9iyN104N2DD1X/BKLfLTlxfrcSS3FGoqEWc1FxIgBUYIkYHQIA AA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151223_023920_681408_1A26AF22 X-CRM114-Status: GOOD ( 14.48 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Viresh Kumar , "open list:CPU FREQUENCY DRIVERS" , "Rafael J. Wysocki" , open list , Andrzej Hajda , "open list:SYSTEM CONTROL & POWER INTERFACE SCPI Message..." , Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Viresh Kumar --- 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);