[PATCH 1/1] staging: pi433: fix problem with division in rf69_set_deviation

From: Marcus Wolf
Date: Thu Jul 20 2017 - 11:56:49 EST


Fixes problem with division in rf69_set_deviation

Fixes: 874bcba65f9a ("staging: pi433: New driver")
Signed-off-by: Marcus Wolf <linux@xxxxxxxxxxxxxxxxxxxxx>

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -221,7 +221,7 @@ int rf69_set_frequency(struct spi_device *spi, u32
frequency)
int rf69_set_frequency(struct spi_device *spi, u32 frequency)
{
int retval;
- u32 f_max;
+ u64 f_max;
u64 f_reg;
u64 f_step;
u8 msb;
@@ -238,7 +238,8 @@ int rf69_set_frequency(struct spi_device *spi, u32
frequency)
do_div(f_step, 524288); // 524288 = 2^19

// check input value
- f_max = f_step * 8388608 / factor;
+ f_max = f_step * 8388608;
+ do_div(f_max, factor);
if (frequency > f_max)
{
dev_dbg(&spi->dev, "setFrequency: illegal input param");