linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alex G." <mr.nuke.me@gmail.com>
To: Keith Busch <keith.busch@intel.com>
Cc: linux-nvme@lists.infradead.org, alex_gagniuc@dellteam.com,
	Austin.Bolen@dell.com, Shyam.Iyer@dell.com,
	Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvme-pci: Avoid use of goto in nvme_reset_work()
Date: Thu, 10 May 2018 12:01:33 -0500	[thread overview]
Message-ID: <5ca7d8f1-d983-0379-b98f-2d5bb17e0a85@gmail.com> (raw)
In-Reply-To: <20180510170038.GA4556@localhost.localdomain>



On 05/10/2018 12:00 PM, Keith Busch wrote:
> On Thu, May 10, 2018 at 11:46:33AM -0500, Alexandru Gagniuc wrote:
>> This patch started as a challenge from Keith relating to code
>> structuring with goto vs return. I think the final result improves
>> readability on two counts:
>> First, it clarifies the separation between work struct and nvme_dev.
>> Second, it makes it clearer what error is being passed on:
>> 'return -ENODEV' vs 'goto out', where 'result' happens to be -ENODEV
>>
>> CC: Keith Busch <keith.busch@intel.com>
>> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> 
> Ah, that's just wrapping a function that has a single out. The challenge
> is to find a better mechanism than 'goto' to unwind a failure that has
> multiple outs, like nvme_probe().

The same principle applies there too. It might have to be wrapped in
several chunks, and it will likely be more readable. Am I supposed to
bite and refactor that too?

Alex

  reply	other threads:[~2018-05-10 17:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 16:46 [PATCH] nvme-pci: Avoid use of goto in nvme_reset_work() Alexandru Gagniuc
2018-05-10 17:00 ` Keith Busch
2018-05-10 17:01   ` Alex G. [this message]
2018-05-11  6:37 ` 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=5ca7d8f1-d983-0379-b98f-2d5bb17e0a85@gmail.com \
    --to=mr.nuke.me@gmail.com \
    --cc=Austin.Bolen@dell.com \
    --cc=Shyam.Iyer@dell.com \
    --cc=alex_gagniuc@dellteam.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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;
as well as URLs for NNTP newsgroup(s).