RE: [PATCH] media: i2c: s5c73m3: make sure we destroy the mutex

2015-03-03 Thread Kamil Debski
From: Hans Verkuil [mailto:hverk...@xs4all.nl]
Sent: Tuesday, March 03, 2015 10:09 AM
> 
> On 03/02/2015 04:00 PM, Lad Prabhakar wrote:
> > From: "Lad, Prabhakar" 
> >
> > Make sure to call mutex_destroy() in case of probe failure or module
> > unload.
> 
> It's not actually necessary to destroy a mutex. Most drivers never do
> this.
> It only helps a bit in debugging.
> 
> I'll delegate this patch to Kamil, and he can decide whether or not to
> apply this.

I agree with Hans here, the patch is not necessary.

> 
> Regards,
> 
>   Hans
> 

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland

> >
> > Signed-off-by: Lad, Prabhakar 
> > ---
> >  drivers/media/i2c/s5c73m3/s5c73m3-core.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
> > b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
> > index ee0f57e..da0b3a3 100644
> > --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
> > +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
> > @@ -1658,7 +1658,6 @@ static int s5c73m3_probe(struct i2c_client
> *client,
> > if (ret < 0)
> > return ret;
> >
> > -   mutex_init(&state->lock);
> > sd = &state->sensor_sd;
> > oif_sd = &state->oif_sd;
> >
> > @@ -1695,6 +1694,8 @@ static int s5c73m3_probe(struct i2c_client
> *client,
> > if (ret < 0)
> > return ret;
> >
> > +   mutex_init(&state->lock);
> > +
> > ret = s5c73m3_configure_gpios(state);
> > if (ret)
> > goto out_err;
> > @@ -1754,6 +1755,7 @@ out_err1:
> > s5c73m3_unregister_spi_driver(state);
> >  out_err:
> > media_entity_cleanup(&sd->entity);
> > +   mutex_destroy(&state->lock);
> > return ret;
> >  }
> >
> > @@ -1772,6 +1774,7 @@ static int s5c73m3_remove(struct i2c_client
> *client)
> > media_entity_cleanup(&sensor_sd->entity);
> >
> > s5c73m3_unregister_spi_driver(state);
> > +   mutex_destroy(&state->lock);
> >
> > return 0;
> >  }
> >

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] media: i2c: s5c73m3: make sure we destroy the mutex

2015-03-03 Thread Hans Verkuil
On 03/02/2015 04:00 PM, Lad Prabhakar wrote:
> From: "Lad, Prabhakar" 
> 
> Make sure to call mutex_destroy() in case of probe failure or module
> unload.

It's not actually necessary to destroy a mutex. Most drivers never do this.
It only helps a bit in debugging.

I'll delegate this patch to Kamil, and he can decide whether or not to apply
this.

Regards,

Hans

> 
> Signed-off-by: Lad, Prabhakar 
> ---
>  drivers/media/i2c/s5c73m3/s5c73m3-core.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c 
> b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
> index ee0f57e..da0b3a3 100644
> --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
> +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
> @@ -1658,7 +1658,6 @@ static int s5c73m3_probe(struct i2c_client *client,
>   if (ret < 0)
>   return ret;
>  
> - mutex_init(&state->lock);
>   sd = &state->sensor_sd;
>   oif_sd = &state->oif_sd;
>  
> @@ -1695,6 +1694,8 @@ static int s5c73m3_probe(struct i2c_client *client,
>   if (ret < 0)
>   return ret;
>  
> + mutex_init(&state->lock);
> +
>   ret = s5c73m3_configure_gpios(state);
>   if (ret)
>   goto out_err;
> @@ -1754,6 +1755,7 @@ out_err1:
>   s5c73m3_unregister_spi_driver(state);
>  out_err:
>   media_entity_cleanup(&sd->entity);
> + mutex_destroy(&state->lock);
>   return ret;
>  }
>  
> @@ -1772,6 +1774,7 @@ static int s5c73m3_remove(struct i2c_client *client)
>   media_entity_cleanup(&sensor_sd->entity);
>  
>   s5c73m3_unregister_spi_driver(state);
> + mutex_destroy(&state->lock);
>  
>   return 0;
>  }
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html