Re: [PATCH] fix 2.5 scsi queue depth setting

Doug Ledford
2002-11-06T20:50:50Z

On Tue, Nov 05, 2002 at 08:24:17PM -0800, Patrick Mansfield wrote:
> +void scsi_slave_detach(struct scsi_device *sdev)
> +{
> + if (--sdev->attached == 0) {
> + if (sdev->host->hostt->slave_detach != NULL)
> + sdev->host->hostt->slave_detach(sdev);
> + scsi_release_commandblocks(sdev);
> + }
> +}
> +/*

Hmmm...either this needs to implement what I alluded to in my writeup a
couple weeks ago and add the lines:

if(sdev->hostdata)
kfree(sdev->hostdata);
sdev->hostdata = NULL;

after the slave_detach call. The other option is to slightly refine the
slave_attach/slave_detach API to specificy that if your attach routine
allocates and hangs memory off of sdev->hostdata, then you *must*
implement a slave_detach() routine and you must free said memory yourself
(and NULL out the pointer to be safe).

--
Doug Ledford <dledford@redhat.com> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606