Skip to content

Commit d8bf3e8

Browse files
Sakari Ailusgregkh
authored andcommitted
media: v4l2-ctrls: Don't reset handler's error in v4l2_ctrl_handler_free()
commit 5a0400a upstream. It's a common pattern in drivers to free the control handler's resources and then return the handler's error code on drivers' error handling paths. Alas, the v4l2_ctrl_handler_free() function also zeroes the error field, effectively indicating successful return to the caller. There's no apparent need to touch the error field while releasing the control handler's resources and cleaning up stale pointers. Not touching the handler's error field is a more certain way to address this problem than changing all the users, in which case the pattern would be likely to re-emerge in new drivers. Do just that, don't touch the control handler's error field in v4l2_ctrl_handler_free(). Fixes: 0996517 ("V4L/DVB: v4l2: Add new control handling framework") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 673ce11 commit d8bf3e8

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/media/v4l2-core/v4l2-ctrls-core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,6 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl)
16611661
kvfree(hdl->buckets);
16621662
hdl->buckets = NULL;
16631663
hdl->cached = NULL;
1664-
hdl->error = 0;
16651664
mutex_unlock(hdl->lock);
16661665
mutex_destroy(&hdl->_lock);
16671666
}

0 commit comments

Comments
 (0)