mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bo Liu <liubo03@inspur.com>
To: <bvanassche@acm.org>, <jgg@ziepe.ca>, <leon@kernel.org>
Cc: <linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Bo Liu <liubo03@inspur.com>
Subject: [PATCH] RDMA/srp: Check dev_set_name() return value
Date: Fri, 5 Aug 2022 01:34:34 -0400	[thread overview]
Message-ID: <20220805053434.3944-1-liubo03@inspur.com> (raw)

It's possible that dev_set_name() returns -ENOMEM, catch and handle this.

Signed-off-by: Bo Liu <liubo03@inspur.com>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 7720ea270ed8..a6f788e3b84b 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3905,8 +3905,9 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
 
 	host->dev.class = &srp_class;
 	host->dev.parent = device->dev->dev.parent;
-	dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
-		     port);
+	if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
+		     port))
+		goto free_host;
 
 	if (device_register(&host->dev))
 		goto free_host;
-- 
2.27.0


             reply	other threads:[~2022-08-05  5:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  5:34 Bo Liu [this message]
2022-08-05 13:57 ` Bart Van Assche
2022-08-05 14:02 ` Jason Gunthorpe

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=20220805053434.3944-1-liubo03@inspur.com \
    --to=liubo03@inspur.com \
    --cc=bvanassche@acm.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®