lkml.org 
[lkml]   [2017]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex
On Thu, Jun 8, 2017 at 12:04 PM, Binoy Jayan <binoy.jayan@linaro.org> wrote:
> The semaphore 'cmd_mutex' is used as a simple mutex, so
> it should be written as one. Semaphores are going away in the future.
>
> Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
> ---

> @@ -1283,7 +1283,7 @@ static int ngene_load_firm(struct ngene *dev)
>
> static void ngene_stop(struct ngene *dev)
> {
> - down(&dev->cmd_mutex);
> + mutex_lock(&dev->cmd_mutex);
> i2c_del_adapter(&(dev->channel[0].i2c_adapter));
> i2c_del_adapter(&(dev->channel[1].i2c_adapter));
> ngwritel(0, NGENE_INT_ENABLE);

Are you sure about this one? There is only one mutex_lock() and
then the structure gets freed without a corresponding mutex_unlock().

I suspect this violates some rules of mutexes, either when compile
testing with "make C=1", or when running with lockdep enabled.

Can we actually have a concurrently held mutex at the time we
get here? If not, using mutex_destroy() in place of the down()
may be the right answer.

Arnd

\
 
 \ /
  Last update: 2017-06-12 01:31    [W:0.135 / U:1.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site