[PATCH 4.4 107/190] clk: scpi: fix return type of __scpi_dvfs_round_rate

2018-04-11 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

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 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/clk/clk-scpi.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- 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;




[PATCH 4.4 107/190] clk: scpi: fix return type of __scpi_dvfs_round_rate

2018-04-11 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

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 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/clk/clk-scpi.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- 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;