From: Guenter Roeck Date: Mon, 21 Apr 2014 17:38:08 +0000 (-0700) Subject: hwmon: (ltc2945) Don't crash the kernel unnecessarily X-Git-Tag: MMI-PSA29.97-13-9~12301^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f75d72309192e52ef9a3efb390b1c4f408c142df;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git hwmon: (ltc2945) Don't crash the kernel unnecessarily An implementation error should not crash the kernel if it is avoidable. Replace BUG() with WARN_ONCE(). Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/ltc2945.c b/drivers/hwmon/ltc2945.c index c104cc32989d..c9cddf5f056b 100644 --- a/drivers/hwmon/ltc2945.c +++ b/drivers/hwmon/ltc2945.c @@ -1,4 +1,4 @@ -/* + /* * Driver for Linear Technology LTC2945 I2C Power Monitor * * Copyright (c) 2014 Guenter Roeck @@ -314,8 +314,8 @@ static ssize_t ltc2945_reset_history(struct device *dev, reg = LTC2945_MAX_ADIN_H; break; default: - BUG(); - break; + WARN_ONCE(1, "Bad register: 0x%x\n", reg); + return -EINVAL; } /* Reset maximum */ ret = regmap_bulk_write(regmap, reg, buf_max, num_regs);