summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-12-15 20:08:04 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-01-08 14:27:51 +0100
commit93a24578de721006055b422c7772e0e417e1983c (patch)
tree07a85ff8f556a2e70150c6fa66d2552b29169c42
parentmedia: staging: tegra-vde: Use __maybe_unused attribute instead of ifdef (diff)
downloadlinux-93a24578de721006055b422c7772e0e417e1983c.tar.xz
linux-93a24578de721006055b422c7772e0e417e1983c.zip
media: cx231xx: replace BUG_ON with recovery code
In cx231xx_i2c_register, if dev->cx231xx_send_usb_command is NULL, the code crashes. However, the callers in cx231xx-core are able to handle the error without crashing. This patch fixes this issue. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-i2c.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index f33b6a077d57..c6659253c6fb 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -515,7 +515,8 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
{
struct cx231xx *dev = bus->dev;
- BUG_ON(!dev->cx231xx_send_usb_command);
+ if (!dev->cx231xx_send_usb_command)
+ return -EINVAL;
bus->i2c_adap = cx231xx_adap_template;
bus->i2c_adap.dev.parent = dev->dev;