OSDN Git Service

media: ti-vpe: cal: Add cal_camerarx_destroy() to cleanup CAMERARX
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 6 Jul 2020 18:36:18 +0000 (20:36 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 19 Jul 2020 07:39:01 +0000 (09:39 +0200)
commitd3665f3b7c08bc50f97b2f308f4b745f7e80b3e8
treec6de29827329bcd4349b8b20bc3338d85ceaeb15
parent6675e871ca4dab14e849298767d34c2722f3ee1e
media: ti-vpe: cal: Add cal_camerarx_destroy() to cleanup CAMERARX

The cal_camerarx_create() function allocates resources with devm_*, and
thus doesn't need any manual cleanup. Those won't hold true for long, as
we will need to store resources that have no devm_* allocation variant
in cal_camerarx. Furthermore, devm_kzalloc() is the wrong memory
allocation API for structures that can be accessed from userspace, as
device nodes can be kept open across device removal.

Add a cal_camerarx_destroy() function to destroy a CAMERARX instance
explicitly, and switch to kzalloc() for memory allocation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/ti-vpe/cal.c