Re: [PATCH] ARM: mach-s3c24xx: Fix boolean expressions in osiris_dvs_notify

From: Krzysztof Kozlowski
Date: Fri Jan 04 2019 - 08:27:32 EST


On Thu, 3 Jan 2019 at 21:46, Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx> wrote:
>
> Fix boolean expressions by using logical AND operator '&&'
> instead of bitwise operator '&'.
>
> This issue was detected with the help of Coccinelle.
>
> Fixes: 4fa084af28ca ("ARM: OSIRIS: DVS (Dynamic Voltage Scaling) supoort.")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>
> ---
> arch/arm/mach-s3c24xx/mach-osiris-dvs.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
> index 058ce73137e8..ccbd7b7965ca 100644
> --- a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
> +++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
> @@ -65,16 +65,16 @@ static int osiris_dvs_notify(struct notifier_block *nb,
>
> switch (val) {
> case CPUFREQ_PRECHANGE:
> - if (old_dvs & !new_dvs ||
> - cur_dvs & !new_dvs) {
> + if (old_dvs && !new_dvs ||
> + cur_dvs && !new_dvs) {

Technically the old code will work fine because all variables are
bools (so 0 or 1). Therefore I am not sure whether this should be
ported to stable.

Anyway the patch is itself okay and I will take it after merge window. Thanks!

Best regards,
Krzysztof