media: v4l2-subdev: fix some NULL vs IS_ERR() checks
The v4l2_subdev_alloc_state() function returns error pointers, it
doesn't return NULL.
Fixes: 0d346d2a6f
("media: v4l2-subdev: add subdev-wide state struct")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
6f5885a775
commit
ba7a93e507
|
@ -253,8 +253,8 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which,
|
|||
int ret;
|
||||
|
||||
sd_state = v4l2_subdev_alloc_state(sd);
|
||||
if (sd_state == NULL)
|
||||
return -ENOMEM;
|
||||
if (IS_ERR(sd_state))
|
||||
return PTR_ERR(sd_state);
|
||||
|
||||
if (!rvin_format_from_pixel(vin, pix->pixelformat))
|
||||
pix->pixelformat = RVIN_DEFAULT_FORMAT;
|
||||
|
|
|
@ -676,9 +676,9 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
|
|||
* rectangles.
|
||||
*/
|
||||
entity->config = v4l2_subdev_alloc_state(&entity->subdev);
|
||||
if (entity->config == NULL) {
|
||||
if (IS_ERR(entity->config)) {
|
||||
media_entity_cleanup(&entity->subdev.entity);
|
||||
return -ENOMEM;
|
||||
return PTR_ERR(entity->config);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -508,8 +508,8 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan,
|
|||
return -ENODEV;
|
||||
|
||||
sd_state = v4l2_subdev_alloc_state(subdev);
|
||||
if (!sd_state)
|
||||
return -ENOMEM;
|
||||
if (IS_ERR(sd_state))
|
||||
return PTR_ERR(sd_state);
|
||||
/*
|
||||
* Retrieve the format information and if requested format isn't
|
||||
* supported, keep the current format.
|
||||
|
|
Loading…
Reference in New Issue