From patchwork Mon Mar 19 16:07:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132053 Delivered-To: patch@linaro.org Received: by 10.80.152.129 with SMTP id j1csp2993819edb; Mon, 19 Mar 2018 09:12:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELt4ZxgSlB2WIBXdCbkihrVXtgQPkco3Wgb7jycfTCWUrxoGltOZcEUbiG3FgPIrCAjXsbDd X-Received: by 10.99.117.92 with SMTP id f28mr9666585pgn.421.1521475937567; Mon, 19 Mar 2018 09:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521475937; cv=none; d=google.com; s=arc-20160816; b=bSnQJZJUz/xT7OfDjbTWFg2e9t0Y7H2Q5C/p/UTFEThjGmhbdXXC9IiqOf639450C7 obp+NPNlBsUHAb98rn/jaxq0yYQzag6eOtefg+gF7/B5xs3mJFwnwCGbCOGIIJI5IaUu 22Y3blunqpO8gYEDExlYQovfImTXd2szcQTnR5wKDEeNd4dZWasrxB/YD2kW5QhpM6D5 LZMlyK3bnoCJ5N2DpRfhbRYSTKR/ISFBQkuMW4oYAfcbko5xBYj38IvuUVhsxb/weRBL MHd20FWlFLHQg9eVKjAuYmdavWm070NaZDu+gQjdsTwaGaS5SpcXJuIUv8vuXFeEin3Z qrzA== 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=jjYKrduvgm1I+kEMxFAd1I3ROjx172A9yBaABBRQB0k=; b=Tg/Qy1TjBe3F+c45FB7OSuMGKA9CRPLUWNiou3kNAuFQm9d2XOYZJmQLW/sdhef5pt SMCIUoccTBClORBArejo3ITJzbPAl/dSPtTyTZ0TkYSF3arJvCe5HjOOEAzV7DnyXJJO d00FLIL3L0g7h3qlLiXcBj1Yyn+ZGY8GCqSogu0SIymMNfY5v1VCD1m4nRobMOJ+t9rL kDDW2NtCOQ98H7oKjm3oLEXHj+TZgmCpdfgqVxS37TE+j33JgGeAvHTa8zs5B6RB/Fy0 rViNr5I5jIdD2WuuRm7In23wofClaZz6hP9c4spqzmvUfPRH1GwkLVwIixnz4l27szeI BkJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=M/etLcZB; 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 s36-v6si224022pld.556.2018.03.19.09.12.17; Mon, 19 Mar 2018 09:12:17 -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=M/etLcZB; 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 S966597AbeCSQMO (ORCPT + 28 others); Mon, 19 Mar 2018 12:12:14 -0400 Received: from mail-by2nam03on0106.outbound.protection.outlook.com ([104.47.42.106]:22396 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966565AbeCSQKH (ORCPT ); Mon, 19 Mar 2018 12:10:07 -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=jjYKrduvgm1I+kEMxFAd1I3ROjx172A9yBaABBRQB0k=; b=M/etLcZBY1YT2gA+u0iy1I3BKZjY3DFkio86+dOBjyYWYoJRiRGkcSiE4F4DkUbz01s1klX345Bb4W9VRoL4gvmzAgegYgTIME2w2hWZLWmPw20TP08Lakr8wT19q6a6d/S1OpmXkvvDelrxCkwOb2m0NQKNTnbb1FgPTmrAWrg= 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:09:59 +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:09:59 +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.4 111/167] clk: scpi: fix return type of __scpi_dvfs_round_rate Thread-Topic: [PATCH AUTOSEL for 4.4 111/167] clk: scpi: fix return type of __scpi_dvfs_round_rate Thread-Index: AQHTv5xol0X3xA81fE+pnP6PZStv5Q== Date: Mon, 19 Mar 2018 16:07:41 +0000 Message-ID: <20180319160513.16384-111-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-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:Xkn1g46ScLPiGLCw2bc1IrjwlgznroBjbvmDEDwJo+j+/7yXcMCigJG4vKrDwmeb9ZsEl5AYN8r72C3XZcgGB1GLq6MSfSxmYKjRMAV3ne92lNOrq0YG6R5nEx5ocVX0TD3y88mjFuPOjtlIus4IV0G1Q3/hfu53m19G6ajXm+MRlxunDocwOH34PH5KtzvE119ZLpsOCcgOeb6Fvtr0P0SxAHagCVrRcSgNpye/hNu3ywrP90AyCPI0rjMVfabk; 20:OeQE4N3exn7hj51/biGodfPag6sWTDGjB7zXN+mE3LEPH3qupfigVchUoXbyR9Y+uIe1+yqvrSqu1ZEULDUwIkYjkrYFQipYAUjz3uRXlmYU18WNHjnHAfzOKaxNpJflvoYxy/cnX1w5DXoON3AmZDnLYW8+Fb2Lq5VEJKcI/bM= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 5084075a-4bcc-4a45-4ea7-08d58db3dd1c 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: xoxGdWSalLDPzpmMIIyDf4hq6QQXdn2kZm/pBdtbmtyudI8qqd1mRZS+DRJIKBBuvBlf6lk78l/A9650CR4mt2iNcEbfgjYi8eNpC2oallZ/VEsBCyBLaWrSesXAncM4NNY2Fc4alm5bVDVTB6kQ2ENCE05GSoqRrj+fpf3LZwmeTPgrLIIU0SCDK7wjS4jgFyoOISBIY/FlwqTdi+1TSQ7065Khwn0BAOzvjdTDYJ0dOiFbkemGc5tPuxgUka3isrjntxHK1rOhjXN5jLPkdXdfTiVC9fGAdAfg4UxIXtpGeCA8po1s2MobTXguS8f558gislM0vWhG0HHhkTh9gw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5084075a-4bcc-4a45-4ea7-08d58db3dd1c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:07:41.2238 (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 cd0f2726f5e0..c40445488d3a 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;