Re: [PATCH 1/2] software node: Add comment for the first ERR_CAST() in fwnode_create_software_node()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 10, 2025 at 09:12:11PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
> 
> 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






[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux