[PATCH V2 4/8] nvme-core: use normal pattern

Christoph Hellwig hch at lst.de
Mon Mar 27 17:42:22 PDT 2023


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.



More information about the Linux-nvme mailing list