summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel@collabora.com>2019-08-15 19:48:06 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-08-26 16:52:36 +0300
commit1a065ee3e97cc58ab900ccb7eb2b421fdab1d0dc (patch)
tree7dbf7d29c493494e21c4b977269453ba4cb6c9c1 /drivers/media/v4l2-core
parent51ff392c280733aa9e6bd47b3f5e83e32bfdf16a (diff)
downloadlinux-1a065ee3e97cc58ab900ccb7eb2b421fdab1d0dc.tar.xz
media: v4l2-core: Remove BUG() from i2c and spi helpers
Currently, the i2c and spi subdev creation helpers are calling BUG() when passed a NULL v4l2_device parameter. This makes little sense; simply returning NULL seems more sensible. These two helpers may already return NULL on error, so callers should already be checking for this, or at least be prepared for a NULL result. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/v4l2-i2c.c3
-rw-r--r--drivers/media/v4l2-core/v4l2-spi.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/v4l2-core/v4l2-i2c.c b/drivers/media/v4l2-core/v4l2-i2c.c
index a26d48f23a2d..d549291ab22b 100644
--- a/drivers/media/v4l2-core/v4l2-i2c.c
+++ b/drivers/media/v4l2-core/v4l2-i2c.c
@@ -64,7 +64,8 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
struct v4l2_subdev *sd = NULL;
struct i2c_client *client;
- BUG_ON(!v4l2_dev);
+ if (!v4l2_dev)
+ return NULL;
request_module(I2C_MODULE_PREFIX "%s", info->type);
diff --git a/drivers/media/v4l2-core/v4l2-spi.c b/drivers/media/v4l2-core/v4l2-spi.c
index 2a7e82e1412d..15162659a63b 100644
--- a/drivers/media/v4l2-core/v4l2-spi.c
+++ b/drivers/media/v4l2-core/v4l2-spi.c
@@ -39,8 +39,8 @@ struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
struct v4l2_subdev *sd = NULL;
struct spi_device *spi = NULL;
- BUG_ON(!v4l2_dev);
-
+ if (!v4l2_dev)
+ return NULL;
if (info->modalias[0])
request_module(info->modalias);