From patchwork Mon Mar 19 16:01:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132046 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2898252ljb; Mon, 19 Mar 2018 09:04:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELtTGw4CIcbyOctF8nzj7+efalMIJPmR+Du6oR0IFe0qKxzKHRxVm6Y/qEY1KdwCBX92D0mh X-Received: by 10.99.97.149 with SMTP id v143mr9508576pgb.319.1521475441120; Mon, 19 Mar 2018 09:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521475441; cv=none; d=google.com; s=arc-20160816; b=qGcqX/XUQxAYvoyNaY8QoAPfoQiBZ8YKaE21gso1hzpen4Rp49sXIQ7H/UzrDVuifL BCVt0ET2Icax2SnxOhgbFkqQeQr5lWzdA/YJYy4T45WLeM760hyJgwDD/RKeARlL0+tb T0eXBsG/C+nCVTGag0+kXz7jeNETF5rbewZVWeeuWp4PHsTioJwEhbBM/YnwsEulaCAy t5M37dC2TKPt/2xk0r22pv+UMI8D3+LbL7c6PATPOlhSBpV3PCDyLntknbYxIQyS6mD2 2EFh57FoHe7RbrxS9tsJMyciukDZMf20Zu2xLJAhgtex6hkROGpbhtUZLhSuxVlugYjZ Q+Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=tqG+1ikWfVXW+fjivo3v4djosD1DOP4+x+1E0+fArb0=; b=ITemKZD+YwUpf8L3NxhHirxqrLy0UnaYusdo1DN7BFt3nF2xBgIun/lCIl9YD+LTvB 89OPuGajEiOEGmadXI/tBwUntyHGvcWEACBbHUSWjpNdRXaxF8/UEazm8dSMFckf3mb4 F9Vrpy79J0fhBe7uM/CgDE3KobKFsnkaCLLX//mnQs9gN4Q98Z/YqBXGWgqRI8ebP4BN 0yl54qdqk+ut2pTYHfHywi2hD569UXkXDNbbPP+yj/ufMUbFcOcve7AX6wMvzPj7fCOe 6d/g9qFhPEWenBrTsjvo5FaKYgWVgEi4iOA08W7qRg3Vf/J7JW95cXTqptv1hREB0sf8 O1Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NLVC+mub; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n16-v6si213653pll.669.2018.03.19.09.03.59; Mon, 19 Mar 2018 09:04:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NLVC+mub; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965614AbeCSQD4 (ORCPT + 28 others); Mon, 19 Mar 2018 12:03:56 -0400 Received: from mail-by2nam03on0139.outbound.protection.outlook.com ([104.47.42.139]:32544 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965474AbeCSQDS (ORCPT ); Mon, 19 Mar 2018 12:03:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tqG+1ikWfVXW+fjivo3v4djosD1DOP4+x+1E0+fArb0=; b=NLVC+mubA3VSe0fWDSeik6Ee3AdDOMSM6q/fdawj32m767i+m8A2+c1eHzudfJ6YDJGJgqv6b/3nVhRhTHLfc6ghDAOxDFuUnd/NcNfNElCkTuDI8d9ZOyf1Sfv7XJIBDkJMOUyMbsqMGmOBPY38jwUEy0KQU6sl07PeiWwc0q8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0919.namprd21.prod.outlook.com (52.132.132.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:03:14 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:03:14 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Sudeep Holla , Michael Turquette , Stephen Boyd , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 177/281] clk: scpi: fix return type of __scpi_dvfs_round_rate Thread-Topic: [PATCH AUTOSEL for 4.9 177/281] clk: scpi: fix return type of __scpi_dvfs_round_rate Thread-Index: AQHTv5uGtHpaVywcdEyu1UMV/zRmWQ== Date: Mon, 19 Mar 2018 16:01:22 +0000 Message-ID: <20180319155742.13731-177-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0919; 7:99aAa6WYrQPqK9Ak/xeb50+w0mw468xtKna4rH0d2NtGMPTaxZXwcKQDt66ClloEHwSYyT2by5unyaGbIVBkU0isOdP8tm6HwZVvlaiq1j6Nu39pUxvxqpCKbP0/kmYT9a+S3ViKAH2JpYhundRha9FU3PK50a7Diae28hjs5rRqSsImGGeT1RsRDeh4oJZv0e08mm/fxFF6aFQwkKUpWkIuvl1Z2AVvJxXdupOH9GK3nv6nf/oADuJQLbwbp55i; 20:ROL8P3QITvAKGq07wgM0ztGSBDMcYaVvHiRy4jf5h7J2EvSCIb8lu5B+lUdu7arkKb7xbYXAv2yvvgDz/MwI4zSRAsnBCjMyI/4HSnacbIdUPTDClNHP1ugoCRaEY4olsZi9S5jclPiVqW6oNIZWWi16hCFE2YnkHyofDwbQzY0= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ce3d10fe-908f-46ae-116c-08d58db2ec1c x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0919; x-ms-traffictypediagnostic: DM5PR2101MB0919: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0919; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0919; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39380400002)(396003)(39860400002)(376002)(366004)(199004)(189003)(66066001)(575784001)(2906002)(86362001)(10290500003)(105586002)(8676002)(305945005)(110136005)(478600001)(4326008)(7736002)(81166006)(3280700002)(6506007)(97736004)(107886003)(5660300001)(36756003)(8936002)(53936002)(86612001)(14454004)(1076002)(2501003)(6116002)(10090500001)(76176011)(186003)(3846002)(5250100002)(6512007)(99286004)(102836004)(106356001)(72206003)(81156014)(2950100002)(6666003)(54906003)(3660700001)(22452003)(68736007)(6486002)(25786009)(26005)(316002)(2900100001)(6436002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0919; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9aroGOtT6OEwbspE0nKvC7tZFWg8nT10hz9b0V3StafM7kesnHCbwgquJTHnKlYk9jznerW0fH2adVWhzCbKHvAsUZnsevK+bZr9hDulY5Hfnq2+z0NVxHcKzNQnsZ0I36sjBcRt2RyCMP1KMa+VdaTL+3bQhniWmbmynoQ7JJFJ7xfTma2TtZFG4PDpMk9unzHxPtj2fxoWTEdq98zMzUS5QD7JU6QkNNdp2Q27F79S+UZz2mx8DKZMzN0lhcSIloGvqTXB0KNoOBSegFK6rh1qq3xQzqz8TyjlZBjOey5QmHAEQcPzpY+UaeMjvsz1bKckzDvwLtDdZJ+vgGIR7Q== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce3d10fe-908f-46ae-116c-08d58db2ec1c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:22.7480 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0919 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla [ Upstream commit 7374aec95636ca39409545eba4ef5ff3125c2346 ] The frequencies above the maximum value of signed integer(i.e. 2^31 -1) will overflow with the current code. This patch fixes the return type of __scpi_dvfs_round_rate from 'int' to 'unsigned long'. Fixes: cd52c2a4b5c4 ("clk: add support for clocks provided by SCP(System Control Processor)") Cc: Michael Turquette Cc: Stephen Boyd Signed-off-by: Sudeep Holla Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-scpi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.14.1 diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c index 96d37175d0ad..8ad458b5ad6e 100644 --- a/drivers/clk/clk-scpi.c +++ b/drivers/clk/clk-scpi.c @@ -71,15 +71,15 @@ static const struct clk_ops scpi_clk_ops = { }; /* find closest match to given frequency in OPP table */ -static int __scpi_dvfs_round_rate(struct scpi_clk *clk, unsigned long rate) +static long __scpi_dvfs_round_rate(struct scpi_clk *clk, unsigned long rate) { int idx; - u32 fmin = 0, fmax = ~0, ftmp; + unsigned long fmin = 0, fmax = ~0, ftmp; const struct scpi_opp *opp = clk->info->opps; for (idx = 0; idx < clk->info->count; idx++, opp++) { ftmp = opp->freq; - if (ftmp >= (u32)rate) { + if (ftmp >= rate) { if (ftmp <= fmax) fmax = ftmp; break;