public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] V4L/DVB: soc-camera: module_put() fix
@ 2010-07-05 10:12 Magnus Damm
  2010-07-05 19:58 ` Guennadi Liakhovetski
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2010-07-05 10:12 UTC (permalink / raw)
  To: g.liakhovetski; +Cc: Magnus Damm, linux-media

From: Magnus Damm <damm@opensource.se>

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

Signed-off-by: Magnus Damm <damm@opensource.se>
---

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

--- 0001/drivers/media/video/soc_camera.c
+++ work/drivers/media/video/soc_camera.c	2010-06-23 13:43:05.000000000 +0900
@@ -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:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] V4L/DVB: soc-camera: module_put() fix
  2010-07-05 10:12 [PATCH] V4L/DVB: soc-camera: module_put() fix Magnus Damm
@ 2010-07-05 19:58 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 2+ messages in thread
From: Guennadi Liakhovetski @ 2010-07-05 19:58 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Linux Media Mailing List

On Mon, 5 Jul 2010, Magnus Damm wrote:

> From: Magnus Damm <damm@opensource.se>
> 
> Avoid calling module_put() if try_module_get() has
> been skipped.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
> 
>  drivers/media/video/soc_camera.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- 0001/drivers/media/video/soc_camera.c
> +++ work/drivers/media/video/soc_camera.c	2010-06-23 13:43:05.000000000 +0900
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-05 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-05 10:12 [PATCH] V4L/DVB: soc-camera: module_put() fix Magnus Damm
2010-07-05 19:58 ` Guennadi Liakhovetski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox