mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Bo Liu <liubo03@inspur.com>, jgg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/srp: Check dev_set_name() return value
Date: Fri, 5 Aug 2022 06:57:20 -0700	[thread overview]
Message-ID: <d105bbea-9414-053a-1481-dfed663c83a8@acm.org> (raw)
In-Reply-To: <20220805053434.3944-1-liubo03@inspur.com>

On 8/4/22 22:34, Bo Liu wrote:
> 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;

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

  reply	other threads:[~2022-08-05 13:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  5:34 Bo Liu
2022-08-05 13:57 ` Bart Van Assche [this message]
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=d105bbea-9414-053a-1481-dfed663c83a8@acm.org \
    --to=bvanassche@acm.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=liubo03@inspur.com \
    /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®