aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/most
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2018-05-08 11:44:51 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-08 13:41:48 +0200
commitceb1edc2a0a52b6f4285fbfc8f29a42b6109e52d (patch)
tree7980ebe0dd39fa121e9bd195d459b29475be4233 /drivers/staging/most
parentstaging: most: dim2: remove clock speed processing from the HDM (diff)
downloadlinux-dev-ceb1edc2a0a52b6f4285fbfc8f29a42b6109e52d.tar.xz
linux-dev-ceb1edc2a0a52b6f4285fbfc8f29a42b6109e52d.zip
staging: most: i2c: prevent division by zero
This prevents division by zero scan_rate. The zero scan_rate does not need any special action as it actually means "never poll again". Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r--drivers/staging/most/i2c/i2c.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/most/i2c/i2c.c b/drivers/staging/most/i2c/i2c.c
index 141239fc9f51..501eec0783a1 100644
--- a/drivers/staging/most/i2c/i2c.c
+++ b/drivers/staging/most/i2c/i2c.c
@@ -252,7 +252,7 @@ static void pending_rx_work(struct work_struct *work)
do_rx_work(dev);
if (dev->polling_mode) {
- if (dev->is_open[CH_RX])
+ if (dev->is_open[CH_RX] && scan_rate)
schedule_delayed_work(&dev->rx.dwork,
msecs_to_jiffies(MSEC_PER_SEC
/ scan_rate));