lkml.org 
[lkml]   [2018]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 2/2] tpm: add support for nonblocking operation
From
Date
On 06/13/2018 10:55 AM, J Freyensee wrote:
>> +    /*
>> +     * If in nonblocking mode schedule an async job to send
>> +     * the command return the size.
>> +     * In case of error the err code will be returned in
>> +     * the subsequent read call.
>> +     */
>> +    if (file->f_flags & O_NONBLOCK) {
>> +        queue_work(tpm_dev_wq, &priv->async_work);
>> +        return size;
>
> Apologies for the question, but should there be a mutex_unlock() here?  It's about the only return statement I am seeing where I cannot tell if a mutex_unlock() will be called before return or is needed before return.  The rest of the code is pretty obvious the return statements are being re-factored to an out: block where the mutex_unlock() will always be called before returning.

Hi Jay,
We need to hold the lock until the whole command is sent and the device is ready for next one.
In case of the async job the mutex in unlocked in tpm_async_work() just after the tpm_transmit() returns.
Thanks for reviewing.
--
Tadeusz

\
 
 \ /
  Last update: 2018-06-13 20:06    [W:0.099 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site