nvmet: add helpers to set the result field for connect commands
authorChristoph Hellwig <hch@lst.de>
Tue, 20 Sep 2022 14:09:57 +0000 (16:09 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 27 Sep 2022 07:22:09 +0000 (09:22 +0200)
commitab46d8d40f01487bf637428c4767f0e75ac2a95a
treea21853a733f4ef42fea447c2b56253e2ca9cb284
parent1c32a8012b7fabe469b6af826edfd4ae2a6201d3
nvmet: add helpers to set the result field for connect commands

The code to set the result field for the admin and I/O connect commands
is not only verbose and duplicated, but also violates the aliasing
rules as it accesses both the u16 and u32 members in the union.

Add a little helper to sort all that out.

Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Hannes Reinecke <hare@suse.de>
drivers/nvme/target/fabrics-cmd.c