public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Zijun Hu <zijun_hu@icloud.com>
Cc: Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zijun Hu <quic_zijuhu@quicinc.com>
Subject: Re: [PATCH 1/2] software node: Add comment for the first ERR_CAST() in fwnode_create_software_node()
Date: Mon, 14 Apr 2025 11:00:35 +0300	[thread overview]
Message-ID: <Z_zAo3PTEWH9nkTt@smile.fi.intel.com> (raw)
In-Reply-To: <20250410-fix_swnode-v1-1-081c95cf7cf9@quicinc.com>

On Thu, Apr 10, 2025 at 09:12:11PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
> 
> ERR_CAST() is normally used to cast an error-valued pointer type to
> another different type, But the first ERR_CAST() is to cast away the
> const in fwnode_create_software_node().
> 
> Add comment for this unusual ERR_CAST() usage.

...

> +	/* Only cast away the const by ERR_CAST() */
>  	if (IS_ERR(parent))
>  		return ERR_CAST(parent);

TBH, I don't see the value of this comment. And looking into the code, I would
rather drop this part. The current users do not rely on the any specific code
to be returned and also they check parent to be valid beforehand.

But let's hear others first.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-04-14  8:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10 13:12 [PATCH 0/2] software node: bug fixes Zijun Hu
2025-04-10 13:12 ` [PATCH 1/2] software node: Add comment for the first ERR_CAST() in fwnode_create_software_node() Zijun Hu
2025-04-14  8:00   ` Andy Shevchenko [this message]
2025-04-14 11:10     ` Zijun Hu
2025-04-10 13:12 ` [PATCH 2/2] software node: Correct a OOB check in software_node_get_reference_args() Zijun Hu
2025-04-14  8:08   ` Andy Shevchenko
2025-04-14 11:12     ` Zijun Hu
2025-04-15  6:42       ` Andy Shevchenko
2025-04-14  8:45   ` Sakari Ailus
2025-04-14  7:23 ` [PATCH 0/2] software node: bug fixes Andy Shevchenko

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=Z_zAo3PTEWH9nkTt@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dakr@kernel.org \
    --cc=djrscally@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_zijuhu@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=zijun_hu@icloud.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