diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2020-08-11 22:59:39 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-10 14:27:46 +0200 |
commit | 86d37bf31af647760f1f17e7c1afa1bdba075198 (patch) | |
tree | 8392ebbc5c5eb672db5c5c248f95433a6ab0b028 /include/media/v4l2-fwnode.h | |
parent | media: rcar-csi2: Allocate v4l2_async_subdev dynamically (diff) | |
download | linux-86d37bf31af647760f1f17e7c1afa1bdba075198.tar.xz linux-86d37bf31af647760f1f17e7c1afa1bdba075198.zip |
media: i2c: max9286: Allocate v4l2_async_subdev dynamically
v4l2_async_notifier_add_subdev() requires the asd to be allocated
dynamically, but the max9286 driver embeds it in the max9286_source
structure. This causes memory corruption when the notifier is destroyed
at remove time with v4l2_async_notifier_cleanup().
Fix this issue by registering the asd with
v4l2_async_notifier_add_fwnode_subdev(), which allocates it dynamically
internally. A new max9286_asd structure is introduced, to store a
pointer to the corresonding max9286_source that needs to be accessed
from bound and unbind callbacks. There's no need to take an extra
explicit reference to the fwnode anymore as
v4l2_async_notifier_add_fwnode_subdev() does so internally.
While at it, use %u instead of %d to print the unsigned index in the
error message from the v4l2_async_notifier_add_fwnode_subdev() error
path.
Fixes: 66d8c9d2422d ("media: i2c: Add MAX9286 driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'include/media/v4l2-fwnode.h')
0 files changed, 0 insertions, 0 deletions