All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [hch@infradead.org: Re: [PATCH] fix 2.5 scsi queue depth setting]
Date: Wed, 6 Nov 2002 16:20:40 -0500	[thread overview]
Message-ID: <20021106212040.GI22177@redhat.com> (raw)
In-Reply-To: <20021106210542.A32241@infradead.org>

On Wed, Nov 06, 2002 at 09:05:42PM +0000, Christoph Hellwig wrote:
> On Wed, Nov 06, 2002 at 03:50:50PM -0500, Doug Ledford wrote:
> > if(sdev->hostdata)
> >   kfree(sdev->hostdata);
> 
> kfree(NULL) is fine, btw..

Yeah, but the existence of a non-NULL pointer can also be used to protect 
against other possible bogus operations (in the case of my driver it isn't 
needed, but I wouldn't begin to assume no other driver would) in the event 
that slave_detach() is ever called twice.

> > 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).
> 
> I'm all for the second option, but I don't think we should specify the
> NULLing out, the device will go away anyway.

Hmmm...I thought this was being done on upper level de-attachment, which 
doesn't always imply device removal.  I'm not sure the device is going 
away in all cases....

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

  reply	other threads:[~2002-11-06 21:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06 21:05 [hch@infradead.org: Re: [PATCH] fix 2.5 scsi queue depth setting] Christoph Hellwig
2002-11-06 21:20 ` Doug Ledford [this message]
2002-11-07  2:13   ` Christoph Hellwig

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=20021106212040.GI22177@redhat.com \
    --to=dledford@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    /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.