diff mbox

thermal: armada: Fix possible overflow in the Armada 380 thermal sensor formula

Message ID 1438877029-32514-1-git-send-email-gregory.clement@free-electrons.com (mailing list archive)
State Accepted
Delegated to: Eduardo Valentin
Headers show

Commit Message

Gregory CLEMENT Aug. 6, 2015, 4:03 p.m. UTC
From: Nadav Haklai <nadavh@marvell.com>

Update the coefficients so the calculation will not overrun the
unsigned long 32bits boundary

Signed-off-by: Nadav Haklai <nadavh@marvell.com>
Reviewed-by: Victor Axelrod <victora@marvell.com>
Reviewed-by: Neta Zur Hershkovits <neta@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 drivers/thermal/armada_thermal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Gregory CLEMENT Sept. 9, 2015, 4:44 p.m. UTC | #1
Hi Zhang,
 
 On jeu., août 06 2015, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:

> From: Nadav Haklai <nadavh@marvell.com>
>
> Update the coefficients so the calculation will not overrun the
> unsigned long 32bits boundary

What is the status of this patch?

I still do not see it in your git tree. If you need any modification to
take it, don't hesitate to tell me.

Thanks,

Gregory


>
> Signed-off-by: Nadav Haklai <nadavh@marvell.com>
> Reviewed-by: Victor Axelrod <victora@marvell.com>
> Reviewed-by: Neta Zur Hershkovits <neta@marvell.com>
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>  drivers/thermal/armada_thermal.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 01255fd65135..363bf91c32a3 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -224,9 +224,9 @@ static const struct armada_thermal_data armada380_data = {
>  	.is_valid_shift = 10,
>  	.temp_shift = 0,
>  	.temp_mask = 0x3ff,
> -	.coef_b = 2931108200UL,
> -	.coef_m = 5000000UL,
> -	.coef_div = 10502,
> +	.coef_b = 1172499100UL,
> +	.coef_m = 2000096UL,
> +	.coef_div = 4201,
>  	.inverted = true,
>  };
diff mbox

Patch

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 01255fd65135..363bf91c32a3 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -224,9 +224,9 @@  static const struct armada_thermal_data armada380_data = {
 	.is_valid_shift = 10,
 	.temp_shift = 0,
 	.temp_mask = 0x3ff,
-	.coef_b = 2931108200UL,
-	.coef_m = 5000000UL,
-	.coef_div = 10502,
+	.coef_b = 1172499100UL,
+	.coef_m = 2000096UL,
+	.coef_div = 4201,
 	.inverted = true,
 };