From: Juergen Lock Date: Fri, 16 Aug 2013 18:00:24 +0000 (-0300) Subject: [media] media: rc: rdev->open or rdev->close can be NULL X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f02dcdd1784d2b56ffa8c528248b60ef142e921d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [media] media: rc: rdev->open or rdev->close can be NULL At least technisat-usb2.c doesn't set these... Signed-off-by: Juergen Lock Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index aa5d8e724622..46da365c9c84 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -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) @@ -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);