All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Lidel <Markus.Lidel@shadowconnect.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	James Bottomley <James.Bottomley@SteelEye.com>,
	SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] scsi core: fix uninitialized variable error
Date: Mon, 06 Feb 2006 09:42:53 +0100	[thread overview]
Message-ID: <43E70C0D.3060301@shadowconnect.com> (raw)
In-Reply-To: <20060205213049.GG16090@parisc-linux.org>

Hello,

Matthew Wilcox wrote:
> On Sun, Feb 05, 2006 at 11:11:24AM -0500, Alan Stern wrote:
>>> -	if (scsi_host_scan_allowed(shost)) {
>>> -		res = scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1,
>>> -					     hostdata);
>>> -		if (res != SCSI_SCAN_LUN_PRESENT)
>>> -			sdev = ERR_PTR(-ENODEV);
>>> -	}
>>> +	if (scsi_host_scan_allowed(shost))
>>> +		scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata);
>>>  	mutex_unlock(&shost->scan_mutex);
>> This assumes that scsi_probe_and_add_lun doesn't assign anything to the 
>> &sdev pointer if it returns anything other than SCSI_SCAN_LUN_PRESENT.  
>> Since that assumption is true for the current code, this version of the 
>> patch will work as well as mine.
> 
> Perhaps the better way to think about this usage of
> scsi_probe_and_add_lun() is "If it finds an sdev, then we should return
> it".  Right now, we're assuming that returning SCSI_SCAN_LUN_PRESENT is
> equivalent to having found an sdev.
> 
> The real problem is that scsi_probe_and_add_lun() has an enormously
> complicated interface.  The good news is that it's static, so we can see
> all its callers.  The bad news is that the kernel-doc comment is out of
> date and not terribly helpful.
> 
> Its callers are:
> 
> scsi_sequential_lun_scan()
> 	scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL)
> 		(!= SCSI_SCAN_LUN_PRESENT)
> scsi_report_lun_scan()
> 	scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL)
> 		(== SCSI_SCAN_NO_RESPONSE)
> __scsi_add_device()
> 	scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata)
> 		(== SCSI_SCAN_LUN_PRESENT in current, unused in my patch)
> __scsi_scan_target()
> 	scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL)
> 		(unused)
> 	scsi_probe_and_add_lun(starget, 0, &bflags, NULL, rescan, NULL)
> 		(== SCSI_SCAN_LUN_PRESENT or SCSI_SCAN_TARGET_PRESENT)
> 
> I can see some ways to simplify this interface.  As noted in a comment:
> 
>                  * XXX add a bflags to scsi_device, and replace the
>                  * corresponding bit fields in scsi_device, so bflags
>                  * need not be passed as an argument.
> 
> I *think* we can get rid of the hostdata parameter.  The only non-NULL
> caller is __scsi_add_device().  The only caller of __scsi_add_device()
> which specifies hostdata is i2o_scsi.  I don't see why it can't use a
> ->slave_alloc in the host template to set hostdata rather than passing
> it in.

Please don't remove the hostdata parameter. It's the only way to get the 
mapping between I2O device and SCSI devices.


Thank you very much.



Best regards,


Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11

E-Mail: Markus.Lidel@shadowconnect.com
URL:    http://www.shadowconnect.com

      parent reply	other threads:[~2006-02-06  8:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02 21:44 [PATCH] scsi core: fix uninitialized variable error Alan Stern
2006-02-05 15:01 ` Matthew Wilcox
2006-02-05 16:11   ` Alan Stern
2006-02-05 21:30     ` Matthew Wilcox
2006-02-05 21:45       ` Alan Stern
2006-02-06  8:42       ` Markus Lidel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43E70C0D.3060301@shadowconnect.com \
    --to=markus.lidel@shadowconnect.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.