diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-05 05:41:53 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-05 15:26:34 -0300 |
commit | 4001dfb4b54dc4b7e5e765f686766e3db88d175b (patch) | |
tree | 5bf27b96e423bc7b2c0416f6c408f877b3685be9 | |
parent | 7adc79980da0a227ecb778b949ed250463599d4d (diff) |
[media] cx231xx-i2c: handle errors with cx231xx_get_i2c_adap()
The cx231xx_get_i2c_adap() function should return the I2C
adapter that will be used to talk with a device. It should never
be NULL, as otherwise the driver will try to dereference a
null pointer.
We might instead fix the callers, but if this condition
ever happens, it is really a driver bug, because i2c_port
should always be a value from enum CX231XX_I2C_MASTER_PORT.
Found when checking the code due to this bug:
[ 39.769021] BUG: unable to handle kernel NULL pointer dereference at 0000000000000002
[ 39.769105] IP: [<ffffffff81638393>] i2c_master_send+0x13/0x70
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-i2c.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 473cd3433fe5..3e7982ef180a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -608,7 +608,7 @@ struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) case I2C_1_MUX_3: return dev->muxc->adapter[1]; default: - return NULL; + BUG(); } } EXPORT_SYMBOL_GPL(cx231xx_get_i2c_adap); |