[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191215190805.2491-1-pakki001@umn.edu>
Date: Sun, 15 Dec 2019 13:08:04 -0600
From: Aditya Pakki <pakki001@....edu>
To: pakki001@....edu
Cc: kjlu@....edu, Mauro Carvalho Chehab <mchehab@...nel.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Allison Randal <allison@...utok.net>,
Michael Ellerman <mpe@...erman.id.au>,
Richard Fontana <rfontana@...hat.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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@....edu>
---
drivers/media/usb/cx231xx/cx231xx-i2c.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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;
--
2.20.1
Powered by blists - more mailing lists