public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Tony Battersby <tonyb@cybernetics.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>,
	linux-scsi@vger.kernel.org,
	James.Bottomley@HansenPartnership.com
Subject: Re: [PATCH] sg: fix races during device removal
Date: Wed, 31 Dec 2008 04:46:37 -0500	[thread overview]
Message-ID: <20081231094637.GA2138@infradead.org> (raw)
In-Reply-To: <495A40D4.5030901@cybernetics.com>

On Tue, Dec 30, 2008 at 10:40:04AM -0500, Tony Battersby wrote:
>  	sdp = sg_get_dev(dev);
>  	if ((!sdp) || (!sdp->device)) {
> +		sg_put_dev(sdp);
>  		unlock_kernel();
>  		return -ENXIO;
>  	}
>  	if (sdp->detached) {
> +		sg_put_dev(sdp);
>  		unlock_kernel();
>  		return -ENODEV;
>  	}

It would be useful if you converted this to the standard goto-based
unwinding with a few labels at the end of the function:


 out_put:
	sg_put_dev(sdp);
 out_unlock:
	unlock_kernel();
 out:
	return error;


      parent reply	other threads:[~2008-12-31  9:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 15:40 [PATCH] sg: fix races during device removal Tony Battersby
2008-12-30 17:53 ` Douglas Gilbert
2008-12-31  8:37 ` FUJITA Tomonori
2008-12-31 20:16   ` Tony Battersby
2008-12-31  9:46 ` Christoph Hellwig [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=20081231094637.GA2138@infradead.org \
    --to=hch@infradead.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dgilbert@interlog.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tonyb@cybernetics.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox