2017-12-12 22:03:04

by Kari Argillander

[permalink] [raw]
Subject: [PATCH] staging: pi433: Fix disordered switch case

Case: SHAPING_0_5 is writing DATAMODUL_MODLATION_SHAPE_0_3 value and
vice versa

Signed-off-by: Kari Argillander <[email protected]>
---
I have checked that defines are correct accounting to the datasheet.

My first patch. Hopefully everything goes like needs to. I do not know
if this should go to stable because patch is for the staging area and it
is known to be unstable. But because Greg is maintainer for both I do
not cc stable here.
---
drivers/staging/pi433/rf69.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 8b6d68f10e8a..bc6d5b6cd186 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -133,8 +133,8 @@ int rf69_set_modulation_shaping(struct spi_device *spi,
switch (mod_shaping) {
case SHAPING_OFF: return rf69_read_mod_write(spi, REG_DATAMODUL, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_NONE);
case SHAPING_1_0: return rf69_read_mod_write(spi, REG_DATAMODUL, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_1_0);
- case SHAPING_0_5: return rf69_read_mod_write(spi, REG_DATAMODUL, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_0_3);
- case SHAPING_0_3: return rf69_read_mod_write(spi, REG_DATAMODUL, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_0_5);
+ case SHAPING_0_5: return rf69_read_mod_write(spi, REG_DATAMODUL, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_0_5);
+ case SHAPING_0_3: return rf69_read_mod_write(spi, REG_DATAMODUL, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_0_3);
default:
dev_dbg(&spi->dev, "set: illegal input param");
return -EINVAL;
--
2.15.1


2017-12-13 13:24:24

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: pi433: Fix disordered switch case

On Wed, Dec 13, 2017 at 12:02:11AM +0200, Kari Argillander wrote:
> Case: SHAPING_0_5 is writing DATAMODUL_MODLATION_SHAPE_0_3 value and
> vice versa
>
> Signed-off-by: Kari Argillander <[email protected]>
> ---
> I have checked that defines are correct accounting to the datasheet.

Looks good.

Fixes: 874bcba65f9a ("staging: pi433: New driver")

regards,
dan carpenter