Skip to contentSkip to conversation

V4L/DVB: soc-camera: module_put() fix

PATCH In review Magnus Damm 2 participants 2 messages Jul 5, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 V4L/DVB: soc-camera: module_put() fix

From: Magnus Damm <[email protected]>

Avoid calling module_put() if try_module_get() has been skipped.

---

 drivers/media/video/soc_camera.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/video/soc_camera.c +2 -1
@@ -1034,7 +1034,8 @@ eiufmt:
 		soc_camera_free_i2c(icd);
 	} else {
 		icl->del_device(icl);
-		module_put(control->driver->owner);
+		if (control && control->driver && control->driver->owner)
+			module_put(control->driver->owner);
 	}
 enodrv:
 eadddev:
#1 lore raw
Quoted 14 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Avoid calling module_put() if try_module_get() has been skipped.

---

 drivers/media/video/soc_camera.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

drivers/media/video/soc_camera.c eiufmt: · line 1041

Quoted 9 lines
drivers/media/video/soc_camera.c +2 -1
@@ -1034,7 +1034,8 @@ eiufmt:
 		soc_camera_free_i2c(icd);
 	} else {
 		icl->del_device(icl);
-		module_put(control->driver->owner);
+		if (control && control->driver && control->driver->owner)
+			module_put(control->driver->owner);
 	}
 enodrv:
 eadddev:

Hm, don't understand. I don't see how this can be a problem. Have you hit a case, when you enter this path with one of those pointers == NULL? Looking at the code, this is only entered from eiufmt or evidstart "if (!icl->board_info)" (i.e., only with the soc_camera_platform driver). And if you got down to one of those errors, you do have all those pointers in place. What am I missing?

Thanks
Guennadi
---
Guennadi Liakhovetski