Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965839AbdGTP4o (ORCPT ); Thu, 20 Jul 2017 11:56:44 -0400 Received: from wp244.webpack.hosteurope.de ([80.237.133.13]:60510 "EHLO wp244.webpack.hosteurope.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965461AbdGTP4k (ORCPT ); Thu, 20 Jul 2017 11:56:40 -0400 Date: Thu, 20 Jul 2017 17:56:36 +0200 (CEST) From: Marcus Wolf To: Dan Carpenter , Geert Uytterhoeven , Greg KH Cc: "kbuild-all@01.org" , "linux-kernel@vger.kernel.org" , Rob Herring , driverdevel , "devicetree@vger.kernel.org" , Grant Likely Message-ID: <255867683.7064.1500566196444@ox.hosteurope.de> In-Reply-To: References: <39f4e59cae6d241235f8f2cc6eebb33c-EhVcX1pHQwdXWkQFBhENSgEKLlwACzJXX19HAVhEWENbS1kLMF52CEtUX1pBSEwcXlJRL1lQWAheVn4GUFc=-webmailer1@server05.webmailer.hosteurope.de> <201707172156.DCyTyWc2%fengguang.wu@intel.com> <652336354.3806.1500549785404@ox.hosteurope.de> <20170720113705.d65hxm3jbki2ynqd@mwanda> Subject: [PATCH 1/1] staging: pi433: fix problem with division in rf69_set_deviation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.3-Rev27 X-Originating-Client: com.openexchange.ox.gui.dhtml X-bounce-key: webpack.hosteurope.de;marcus.wolf@wolf-entwicklungen.de;1500566200;43d7feed; X-HE-SMSGID: 1dYDoa-0003WJ-Hp Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 858 Lines: 29 Fixes problem with division in rf69_set_deviation Fixes: 874bcba65f9a ("staging: pi433: New driver") Signed-off-by: Marcus Wolf 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");