public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chaitanya Kulkarni <kch@nvidia.com>
Cc: linux-nvme@lists.infradead.org, kbusch@kernel.org, hch@lst.de,
	sagi@grimberg.me, hare@suse.de
Subject: Re: [PATCH V2 4/8] nvme-core: use normal pattern
Date: Tue, 28 Mar 2023 02:42:22 +0200	[thread overview]
Message-ID: <20230328004222.GB21054@lst.de> (raw)
In-Reply-To: <20230327060418.86655-5-kch@nvidia.com>

On Sun, Mar 26, 2023 at 11:04:14PM -0700, Chaitanya Kulkarni wrote:
> Although return is allowed in the switch ... case when function is
> returing void, it creates confusion for future code which is desirable
> pattern to use for switch ... case. Repalce return in the switch with
> break that is standard pattern for the switch ... case.

I don't really see any point in doing that.  An early return makes it
clear what is going on here, and the logic is so that we really
should never have code after the switch as the calls inside the
switch statement "dispose" of the command, so anything done there
would cause use after free issues.


  reply	other threads:[~2023-03-28  0:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  6:04 [PATCH V2 0/8] nvme-core: trivial cleanups Chaitanya Kulkarni
2023-03-27  6:04 ` [PATCH V2 1/8] nvme-core: remove unnecessary else Chaitanya Kulkarni
2023-03-28  0:40   ` Christoph Hellwig
2023-03-27  6:04 ` [PATCH V2 2/8] nvme-core: remvoe extra line at end of function Chaitanya Kulkarni
2023-03-27  6:04 ` [PATCH V2 3/8] nvme-core: code cleanup for __nvme_check_ready() Chaitanya Kulkarni
2023-03-27 11:15   ` Pankaj Raghav
2023-03-27  6:04 ` [PATCH V2 4/8] nvme-core: use normal pattern Chaitanya Kulkarni
2023-03-28  0:42   ` Christoph Hellwig [this message]
2023-03-27  6:04 ` [PATCH V2 5/8] nvme-core: open code nvme_delete_ctrl_sync() Chaitanya Kulkarni
2023-03-27  6:04 ` [PATCH V2 6/8] nvme-core: cleanup for nvme_set_latency_tolerance Chaitanya Kulkarni
2023-03-27  6:04 ` [PATCH V2 7/8] nvme-core: remove unneacessary else Chaitanya Kulkarni
2023-03-27  6:04 ` [PATCH V2 8/8] nvme-core: fix nvme_submit_sync_cmd() args Chaitanya Kulkarni
2023-03-28  0:43   ` Christoph Hellwig
2023-03-28  5:46     ` Chaitanya Kulkarni
2023-03-28  6:12 ` [PATCH V2 0/8] nvme-core: trivial cleanups Chaitanya Kulkarni

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=20230328004222.GB21054@lst.de \
    --to=hch@lst.de \
    --cc=hare@suse.de \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --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