linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: Use PTR_ERR_OR_ZERO() in nvmet_init_discovery()
@ 2019-09-06 18:00 Markus Elfring
  2019-09-06 18:13 ` Sagi Grimberg
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-09-06 18:00 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Sagi Grimberg
  Cc: YueHaibing, zhong jiang, kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 6 Sep 2019 19:50:19 +0200

Simplify this function implementation by using a known function.

Generated by: scripts/coccinelle/api/ptr_ret.cocci
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/nvme/target/discovery.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c
index 8efca26b4776..3764a8900850 100644
--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -381,9 +381,7 @@ int __init nvmet_init_discovery(void)
 {
 	nvmet_disc_subsys =
 		nvmet_subsys_alloc(NVME_DISC_SUBSYS_NAME, NVME_NQN_DISC);
-	if (IS_ERR(nvmet_disc_subsys))
-		return PTR_ERR(nvmet_disc_subsys);
-	return 0;
+	return PTR_ERR_OR_ZERO(nvmet_disc_subsys);
 }

 void nvmet_exit_discovery(void)
--
2.23.0


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-06 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 18:00 [PATCH] nvmet: Use PTR_ERR_OR_ZERO() in nvmet_init_discovery() Markus Elfring
2019-09-06 18:13 ` Sagi Grimberg

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).