Re: [PATCH v2] target_core_alua: silence GCC warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2014-02-20 at 09:07 +0100, Paul Bolle wrote:
> Building target_core_alua.o triggers a GCC warning:
>     drivers/target/target_core_alua.c: In function ‘target_alua_state_check’:
>     drivers/target/target_core_alua.c:773:18: warning: ‘alua_ascq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>        cmd->scsi_ascq = alua_ascq;
>                       ^
> 
> This is a false positive. A little trial and error shows it is
> apparently caused by core_alua_state_lba_dependent(). It must be hard
> for GCC to track the branches of a switch statement, inside a
> list_for_each_entry loop, inside a while loop.
> 
> But if we add a small (inline) helper function we can reorganize the
> code a bit. That also allows to drop alua_ascq which, obviously, gets
> rid of this warning.
> 
> Signed-off-by: Paul Bolle <pebolle@xxxxxxxxxx>
> ---
> v2: Make core_alua_state_nonoptimized() return void, as Geert
> suggested. 
> 
> Also keep core_alua_state_lba_dependent() inline. Setting that function
> noinline was just a leftover from the trial and error fase, and isn't
> needed to make the warning go away. Ie, I was sloppy in v1!
> 
> Still compile tested only.
> 
>  drivers/target/target_core_alua.c | 95 ++++++++++++++++++---------------------
>  1 file changed, 44 insertions(+), 51 deletions(-)
> 

Applied to target-pending/for-next.

Thanks Paul!

--nab

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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux