[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <255867683.7064.1500566196444@ox.hosteurope.de>
Date: Thu, 20 Jul 2017 17:56:36 +0200 (CEST)
From: Marcus Wolf <marcus.wolf@...f-entwicklungen.de>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Greg KH <gregkh@...uxfoundation.org>
Cc: "kbuild-all@...org" <kbuild-all@...org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Rob Herring <robh+dt@...nel.org>,
driverdevel <devel@...verdev.osuosl.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Grant Likely <grant.likely@...aro.org>
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@...f-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");
Powered by blists - more mailing lists