Skip to content

Commit

Permalink
V4L/DVB (10791): videodev: not possible to register NULL video_device
Browse files Browse the repository at this point in the history
video_register_device_index() checks if it was passed a NULL video_device
pointer (which isn't allowed) _after_ it has already dereferenced it with
video_get_drvdata(vdev).  The checks are clearly pointless and can be
removed, as the function would have crashed before reaching them if vdev
ever was NULL.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Trent Piepho authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent f985c70 commit 428c8d1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/media/video/v4l2-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,11 @@ int video_register_device_index(struct video_device *vdev, int type, int nr,

/* A minor value of -1 marks this video device as never
having been registered */
if (vdev)
vdev->minor = -1;
vdev->minor = -1;

/* the release callback MUST be present */
WARN_ON(!vdev || !vdev->release);
if (!vdev || !vdev->release)
WARN_ON(!vdev->release);
if (!vdev->release)
return -EINVAL;

/* Part 1: check device type */
Expand Down

0 comments on commit 428c8d1

Please sign in to comment.