[PATCH linux dev-4.10 v3 08/31] drivers: fsi: sbefifo: Do an earlier get_client call
Andrew Jeffery
andrew at aj.id.au
Fri Oct 6 08:57:56 AEDT 2017
On Thu, 2017-10-05 at 14:24 -0500, Eddie James wrote:
> From: "Edward A. James" <eajames at us.ibm.com>
>
> Get client before we start using it.
>
> Signed-off-by: Edward A. James <eajames at us.ibm.com>
I still think the refounting of clients is a bit odd, but if we need to do
it this seems reasonable.
Acked-by: Andrew Jeffery <andrew at aj.id.au>
> ---
> drivers/fsi/fsi-sbefifo.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
> index a5bdc75..5efba30 100644
> --- a/drivers/fsi/fsi-sbefifo.c
> +++ b/drivers/fsi/fsi-sbefifo.c
> @@ -656,6 +656,7 @@ static ssize_t sbefifo_write_common(struct sbefifo_client *client,
> if (!len)
> return 0;
>
> + sbefifo_get_client(client);
> n = sbefifo_buf_nbwriteable(&client->wbuf);
>
> spin_lock_irq(&sbefifo->lock);
> @@ -663,19 +664,19 @@ static ssize_t sbefifo_write_common(struct sbefifo_client *client,
>
> if ((client->f_flags & O_NONBLOCK) && xfr && n < len) {
> spin_unlock_irq(&sbefifo->lock);
> - return -EAGAIN;
> + ret = -EAGAIN;
> + goto out;
> }
>
> xfr = sbefifo_enq_xfr(client);
> if (!xfr) {
> spin_unlock_irq(&sbefifo->lock);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto out;
> }
>
> spin_unlock_irq(&sbefifo->lock);
>
> - sbefifo_get_client(client);
> -
> /*
> * Partial writes are not really allowed in that EOT is sent exactly
> * once per write.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20171006/15d04c26/attachment.sig>
More information about the openbmc
mailing list