public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Zhi Song <zhi.song@bytedance.com>
Cc: rafael@kernel.org, Jonathan.Cameron@huawei.com,
	kbusch@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] node: fix error handling in node_init_node_access
Date: Mon, 27 Jun 2022 15:26:41 +0200	[thread overview]
Message-ID: <YrmwEUSIrVxM8OSF@kroah.com> (raw)
In-Reply-To: <20220621171623.1959231-1-zhi.song@bytedance.com>

On Wed, Jun 22, 2022 at 01:16:23AM +0800, Zhi Song wrote:
> dev_set_name() allocates new space to dev->name if it allocates
> successfully. But if we failed to allocate space, there won't be any
> new space for dev->name. Therefore, there's no need for calling
> kfree_const(dev->kobj.name) in dev_set_name()'s error handling.

Can you actually trigger a failure in dev_set_name()?  I ask as we don't
seem to check this anywhere in the driver core, and we should either
just not care (as it really can not fail), or fix up all instances of
that failure.

> If we failed to calling device_register(dev), we just need to call
> put_device(dev) which will do access_node freeing, kobj.name freeing
> and other cleanup.

That is a separate issue, and should be a separate change, right?

thanks,

greg k-h

      reply	other threads:[~2022-06-27 13:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 17:16 [PATCH v4] node: fix error handling in node_init_node_access Zhi Song
2022-06-27 13:26 ` Greg KH [this message]

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=YrmwEUSIrVxM8OSF@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=zhi.song@bytedance.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