linux/drivers/usb
Laurent Pinchart 277966749f media: Reset file->private_data to NULL in v4l2_fh_del()
Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset
the file->private_data pointer to NULL in their video device .release()
file operation handler. Move the code to the v4l2_fh_del() function to
avoid direct access to file->private_data in drivers. This requires
adding a file pointer argument to the function.

Changes to drivers have been generated with the following coccinelle
semantic patch:

@@
expression fh;
identifier filp;
identifier release;
type ret;
@@
ret release(..., struct file *filp, ...)
{
	<...
-	filp->private_data = NULL;
	...
-	v4l2_fh_del(fh);
+	v4l2_fh_del(fh, filp);
	...>
}

@@
expression fh;
identifier filp;
identifier release;
type ret;
@@
ret release(..., struct file *filp, ...)
{
	<...
-	v4l2_fh_del(fh);
+	v4l2_fh_del(fh, filp);
	...
-	filp->private_data = NULL;
	...>
}

@@
expression fh;
identifier filp;
identifier release;
type ret;
@@
ret release(..., struct file *filp, ...)
{
	<...
-	v4l2_fh_del(fh);
+	v4l2_fh_del(fh, filp);
	...>
}

Manual changes have been applied to Documentation/ to update the usage
patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the
v4l2_fh_del() prototype and reset file->private_data, and to
include/media/v4l2-fh.h to update the v4l2_fh_del() function prototype
and its documentation.

Additionally, white space issues have been fixed manually in
drivers/usb/gadget/function/uvc_v4l2.c

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2025-08-13 08:33:44 +02:00
..
atm usb: atm: cxacru: Merge cxacru_upload_firmware() into cxacru_heavy_init() 2025-07-24 11:33:31 +02:00
c67x00
cdns3 usb: cdnsp: Fix issue with CV Bad Descriptor test 2025-06-24 15:42:39 +01:00
chipidea usb: chipidea: imx: Add a missing blank line 2025-07-21 16:31:37 +02:00
class USB / Thunderbolt changes for 6.17-rc1 2025-07-29 10:17:10 -07:00
common usb: common: usb-conn-gpio: use a unique name for usb connector device 2025-04-11 16:08:34 +02:00
core Driver core changes for 6.17-rc1 2025-07-29 12:15:39 -07:00
dwc2 Linux 6.16-rc7 2025-07-21 10:55:57 +02:00
dwc3 usb: dwc3: meson-g12a: fix device leaks at unbind 2025-07-25 10:50:43 +02:00
early usb: early: xhci-dbc: Fix early_ioremap leak 2025-07-07 11:04:46 +02:00
fotg210 usb: fotg210-hcd: Switch to use hrtimer_setup() 2025-02-18 11:19:02 +01:00
gadget media: Reset file->private_data to NULL in v4l2_fh_del() 2025-08-13 08:33:44 +02:00
host usb: xhci: print xhci->xhc_state when queue_command failed 2025-07-25 10:50:24 +02:00
image
isp1760 treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
misc usb: misc: onboard_usb_dev: Add Bison Electronics Inc. Integrated Camera 2025-06-30 15:42:16 +02:00
mon
mtu3
musb usb: musb: omap2430: clean up probe error handling 2025-07-25 10:50:44 +02:00
phy usb: phy: tegra: Remove unused functions 2025-06-19 12:26:32 +02:00
renesas_usbhs usb: renesas_usbhs: Convert to DEFINE_SIMPLE_DEV_PM_OPS() 2025-07-15 19:49:52 +02:00
roles usb: roles: set switch registered flag early on 2025-02-14 09:26:25 +01:00
serial treewide: rename GPIO set callbacks back to their original names 2025-08-07 10:07:06 +02:00
storage usb: storage: reltek_cr: convert to use secs_to_jiffies 2025-06-19 12:27:36 +02:00
typec usb: typec: ucsi: Update power_supply on power role change 2025-07-21 16:33:23 +02:00
usbip sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
Kconfig
Makefile
usb-skeleton.c