aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorBen Dooks <ben@simtec.co.uk>2009-11-16 06:45:39 -0500
committerJean Delvare <khali@linux-fr.org>2009-11-16 06:45:39 -0500
commitbe4c23c93c4828d36ac9e1a88410618a61676426 (patch)
tree2da7bc33a0b6f8fcdd43117d26d30bb479c2db2c /drivers/hwmon
parenta9366e61b03f55a6e009e687ad10e706714c9907 (diff)
hwmon: (s3c-hwmon) Ignore invalid divider settings
Avoid registering channels that have zero divider settings in them, as this will only lead to kernel OOPS from divide-by-zero when the sysfs entry is read. Signed-off-by: Ben Dooks <ben@simtec.co.uk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/s3c-hwmon.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c
index 3a524f2fe49..71835412529 100644
--- a/drivers/hwmon/s3c-hwmon.c
+++ b/drivers/hwmon/s3c-hwmon.c
@@ -323,14 +323,21 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
323 } 323 }
324 324
325 for (i = 0; i < ARRAY_SIZE(pdata->in); i++) { 325 for (i = 0; i < ARRAY_SIZE(pdata->in); i++) {
326 if (!pdata->in[i]) 326 struct s3c24xx_adc_hwmon_incfg *cfg = pdata->in[i];
327
328 if (!cfg)
327 continue; 329 continue;
328 330
329 if (pdata->in[i]->mult >= 0x10000) 331 if (cfg->mult >= 0x10000)
330 dev_warn(&dev->dev, 332 dev_warn(&dev->dev,
331 "channel %d multiplier too large\n", 333 "channel %d multiplier too large\n",
332 i); 334 i);
333 335
336 if (cfg->divider == 0) {
337 dev_err(&dev->dev, "channel %d divider zero\n", i);
338 continue;
339 }
340
334 ret = s3c_hwmon_create_attr(&dev->dev, pdata->in[i], 341 ret = s3c_hwmon_create_attr(&dev->dev, pdata->in[i],
335 &hwmon->attrs[i], i); 342 &hwmon->attrs[i], i);
336 if (ret) { 343 if (ret) {