Skip to content

Commit

Permalink
[media] media: rc: rdev->open or rdev->close can be NULL
Browse files Browse the repository at this point in the history
At least technisat-usb2.c doesn't set these...

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
  • Loading branch information
Juergen Lock authored and Mauro Carvalho Chehab committed Aug 23, 2013
1 parent 5be789f commit f02dcdd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/rc/rc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ int rc_open(struct rc_dev *rdev)
return -EINVAL;

mutex_lock(&rdev->lock);
if (!rdev->users++)
if (!rdev->users++ && rdev->open != NULL)
rval = rdev->open(rdev);

if (rval)
Expand All @@ -735,7 +735,7 @@ void rc_close(struct rc_dev *rdev)
if (rdev) {
mutex_lock(&rdev->lock);

if (!--rdev->users)
if (!--rdev->users && rdev->close != NULL)
rdev->close(rdev);

mutex_unlock(&rdev->lock);
Expand Down

0 comments on commit f02dcdd

Please sign in to comment.