lkml.org 
[lkml]   [2017]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/1] staging: pi433: fix problem with division in rf69_set_deviation
Fixes problem with division in rf69_set_deviation

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

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");
\
 
 \ /
  Last update: 2017-07-20 23:23    [W:0.075 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site