All of lore.kernel.org
 help / color / mirror / Atom feed
* re: mtip32xx: Add new bitwise flag 'dd_flag'
@ 2012-04-16 11:12 Dan Carpenter
  2012-04-16 19:21 ` Asai Thambi S P
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-04-16 11:12 UTC (permalink / raw)
  To: asamymuthupa; +Cc: Jens Axboe, linux-kernel

Hello Asai Thambi S P,

The patch 45038367c271: "mtip32xx: Add new bitwise flag 'dd_flag'"
from Apr 9, 2012, leads to the following Smatch warning:
drivers/block/mtip32xx/mtip32xx.c:2516 mtip_hw_get_scatterlist()
	 warn: inconsistent returns sem:&dd->port->cmd_slot: locked (2514,2516) unlocked ()

@@ -2193,6 +2245,10 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd,
        down(&dd->port->cmd_slot);
        *tag = get_slot(dd->port);
 
+       if (unlikely(test_bit(MTIP_DD_FLAG_REMOVE_PENDING_BIT, &dd->dd_flag))) {
+               up(&dd->port->cmd_slot);
                ^^^^^^^^^^^^^^^^^^^^^^^
We release the lock here.

+               return NULL;
+       }
        if (unlikely(*tag < 0))
                return NULL;
                ^^^^^^^^^^^^
Should we release it here as well?

regards,
dan carpenter


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

* Re: mtip32xx: Add new bitwise flag 'dd_flag'
  2012-04-16 11:12 mtip32xx: Add new bitwise flag 'dd_flag' Dan Carpenter
@ 2012-04-16 19:21 ` Asai Thambi S P
  0 siblings, 0 replies; 2+ messages in thread
From: Asai Thambi S P @ 2012-04-16 19:21 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jens Axboe, linux-kernel

On 4/16/2012 4:12 AM, Dan Carpenter wrote:

> Hello Asai Thambi S P,
> 
> The patch 45038367c271: "mtip32xx: Add new bitwise flag 'dd_flag'"
> from Apr 9, 2012, leads to the following Smatch warning:
> drivers/block/mtip32xx/mtip32xx.c:2516 mtip_hw_get_scatterlist()
> 	 warn: inconsistent returns sem:&dd->port->cmd_slot: locked (2514,2516) unlocked ()
> 
> @@ -2193,6 +2245,10 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd,
>         down(&dd->port->cmd_slot);
>         *tag = get_slot(dd->port);
>  
> +       if (unlikely(test_bit(MTIP_DD_FLAG_REMOVE_PENDING_BIT, &dd->dd_flag))) {
> +               up(&dd->port->cmd_slot);
>                 ^^^^^^^^^^^^^^^^^^^^^^^
> We release the lock here.
> 
> +               return NULL;
> +       }
>         if (unlikely(*tag < 0))
>                 return NULL;
>                 ^^^^^^^^^^^^
> Should we release it here as well?
> 

Thanks for finding this. I should start using smatch :). I will send out the
patch.

--
Regards,
Asai Thambi


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

end of thread, other threads:[~2012-04-16 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-16 11:12 mtip32xx: Add new bitwise flag 'dd_flag' Dan Carpenter
2012-04-16 19:21 ` Asai Thambi S P

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.