UPSTREAM: media: uvcvideo: Fix driver reference counting

commit f9ffcb0a21e1fa8e64d09ed613d884e054ae8191 upstream

kref_init initializes the reference count to 1, not 0. This additional
reference is never released since the conversion to reference counters.
As a result, uvc_delete is not called anymore when UVC cameras are
disconnected.
Fix this by adding an additional kref_put in uvc_disconnect and in the
probe error path. This also allows to remove the temporary additional
reference in uvc_unregister_video.

Fixes: 9d15cd958c17 ("media: uvcvideo: Convert from using an atomic variable to a reference count")

Signed-off-by: Philipp Zabel <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Sudip Mukherjee <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit e75194d294421704baf4c577e504cb9c92ec7ce2)
Signed-off-by: Daniel Kurtz <[email protected]>

BUG=chromium:901671,b:119291953
TEST=build, boot & sanity check on grunt

Change-Id: I703b0712ea6c1d9f86a7adcd295e6728db798a09
Reviewed-on: https://chromium-review.googlesource.com/c/1334449
Reviewed-by: Guenter Roeck <[email protected]>
Commit-Queue: Daniel Kurtz <[email protected]>
Tested-by: Daniel Kurtz <[email protected]>
1 file changed