media: go7007: unregister the I2C adapter on USB probe failure
Subsystems (2)
PATCH 1/1 media: go7007: unregister the I2C adapter on USB probe failure
USB probe failures after I2C adapter registration free the backing go7007 structure without unregistering the adapter.
If i2c_adapter_online is set, unregister the adapter before releasing USB resources so that I2C client removal can still use its callbacks.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
Fixes 59aea928d57f ("[media] go7007: don't continue if firmware can't be loaded")
Co-developed-by Ijae Kim <[email protected]>
Signed-off-by Ijae Kim <[email protected]>
Signed-off-by Myeonghun Pak <[email protected]>
Assisted-by OpenAI:GPT-5.6
---
Validated with an ARM64 W=1 object build and strict checkpatch. No hardware runtime or probe-failure injection testing was performed.
drivers/media/usb/go7007/go7007-usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/go7007/go7007-usb.c +2 -0
@@ -1320,6 +1320,8 @@ static int go7007_usb_probe(struct usb_interface *intf,return 0 ; allocfail: +if (go->i2c_adapter_online) +i2c_del_adapter (&go->i2c_adapter);go7007_usb_release (go);kfree (go);return -ENOMEM ;