Re: iscsi_add_session() warning

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

 



On Tue, Feb 3, 2009 at 4:12 PM, Kyle McMartin <kyle@xxxxxxxxxxxxx> wrote:
> On Tue, Feb 03, 2009 at 04:09:00PM -0800, Andrew Morton wrote:
>> :     if (id == ISCSI_MAX_TARGET) {
>> :             for (id = 0; id < ISCSI_MAX_TARGET; id++) {
>> :                     err = device_for_each_child(&shost->shost_gendev, &id,
>
> Possibly GCC just can't figure out that id was reinitialized, so it
> thinks that the for loop won't be executed?

Would restructuring the code slightly be ok?

  if (target_id ==  ISCSI_MAX_TARGET) {
     unsigned int id = 0;
...
     session->target_id = id;
  } else {
     session->target_id = target_id;
  }
...

ie. reduce the scope of "id" . Not quite a concise as existing code
but just as readable.

hth,
grant

> Just a guess...
>        Kyle
> --
> 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
>
--
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