From 6b6d1e009a0168bd8c4eb62f060ba1cb1fe8cc62 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 29 Aug 2025 16:57:34 +0100 Subject: [PATCH] camera-diagnostics: Fix missing release function The camera-diagnostic driver is missing a release function for the IVC channel device that it is creating. This causes the following WARNING to be observed when probing the camera-diagnostic driver fails ... ------------[ cut here ]------------ Device 'camera-diag' does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst. WARNING: CPU: 8 PID: 756 at drivers/base/core.c:2517 device_release+0x88/0xa8 ... Call trace: device_release+0x88/0xa8 kobject_put+0xac/0x150 put_device+0x14/0x34 __mod_of__camera_diag_of_match_device_table+0x602514/0x6033a0 [camera_diagnostics] tegra_ivc_bus_boot_sync+0x204/0x28c [ivc_bus] really_probe+0x150/0x2c8 __driver_probe_device+0x78/0x134 driver_probe_device+0x3c/0x164 __driver_attach+0x98/0x1c4 bus_for_each_dev+0x7c/0xf4 driver_attach+0x24/0x38 bus_add_driver+0xec/0x218 driver_register+0x5c/0x13c tegra_ivc_driver_register+0x10/0x1c [ivc_bus] init_module+0x18/0x1000 [camera_diagnostics] do_one_initcall+0x58/0x318 do_init_module+0x58/0x1ec load_module+0x1f04/0x2000 init_module_from_file+0x88/0xd4 __arm64_sys_finit_module+0x148/0x330 invoke_syscall+0x48/0x134 el0_svc_common.constprop.0+0x40/0xf0 do_el0_svc+0x1c/0x30 el0_svc+0x30/0xb8 el0t_64_sync_handler+0x130/0x13c el0t_64_sync+0x194/0x198 ---[ end trace 0000000000000000 ]--- Ideally we would use the 'tegra_ivc_channel_release()' function as the release function but because the camera-diagnostic driver does not call 'tegra_ivc_channel_create()' to create the channel and does not actually need to free any memory, simply define a new empty function that can be called. Bug 5489551 Change-Id: I6a7de9893af0167409af79599b61faf005047b0e Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3443095 (cherry picked from commit f75c0f228ca4f1a4c17266cb97be2db63b25a592) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3453753 GVS: buildbot_gerritrpt Reviewed-by: Brad Griffis --- drivers/platform/tegra/rtcpu/camera-diagnostics.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/platform/tegra/rtcpu/camera-diagnostics.c b/drivers/platform/tegra/rtcpu/camera-diagnostics.c index 455b4f58..62013c59 100644 --- a/drivers/platform/tegra/rtcpu/camera-diagnostics.c +++ b/drivers/platform/tegra/rtcpu/camera-diagnostics.c @@ -1174,6 +1174,13 @@ static const struct attribute_group camera_diag_attr_group = { .attrs = camera_diag_attrs, }; +static void camera_diag_ivc_channel_release(struct device *dev) +{ + /* + * This callback is required by the driver core even if there is + * nothing to do otherwise a WARNING message is generated. + */ +} /** * @brief Probe function for camera-diagnostics driver. @@ -1205,6 +1212,7 @@ static int camera_diag_probe(struct tegra_ivc_channel *chan) dev_set_name(&ch->dev, "camera-diag"); ch->dev.parent = &chan->dev; ch->dev.type = &tegra_ivc_channel_type; + ch->dev.release = camera_diag_ivc_channel_release; ch->ivc = chan; /* Set driver data */