All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: cx231xx: replace BUG_ON with recovery code
@ 2019-12-15 19:08 Aditya Pakki
  2019-12-15 19:20 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-12-15 19:08 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Mauro Carvalho Chehab, Kate Stewart, Thomas Gleixner,
	Allison Randal, Michael Ellerman, Richard Fontana, linux-media,
	linux-kernel

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>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: cx231xx: replace BUG_ON with recovery code
  2019-12-15 19:08 [PATCH] media: cx231xx: replace BUG_ON with recovery code Aditya Pakki
@ 2019-12-15 19:20 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2019-12-15 19:20 UTC (permalink / raw)
  To: Aditya Pakki, linux-media
  Cc: linux-kernel, Allison Randal, Kangjie Lu, Kate Stewart,
	Mauro Carvalho Chehab, Michael Ellerman, Richard Fontana,
	Thomas Gleixner

> The patch fixes this issue.

Please replace this sentence by the tag “Fixes”.

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-15 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 19:08 [PATCH] media: cx231xx: replace BUG_ON with recovery code Aditya Pakki
2019-12-15 19:20 ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.