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