Re: [PATCH v7 2/2] scsi: ufs: core: Add support for static TX Equalization settings
From: Can Guo
Date: Thu Jun 11 2026 - 10:15:22 EST
On 6/11/2026 6:11 PM, Peter Wang (王信友) wrote:
Thanks for your review and suggestions, I will update accordingly in next version.
On Wed, 2026-06-10 at 00:15 -0700, Can Guo wrote:
> +static int ufshcd_parse_tx_eq_value_array(struct ufs_hba *hba,
> + const char *prop_name,
> + const u32 max_value,
> + u32 values[UFS_MAX_LANES *
> 2])
> +{
> + u32 num_elems = 2 * hba->lanes_per_direction;
> + struct device *dev = hba->dev;
> + int count, err, i;
> +
> + count = of_property_count_u32_elems(dev->of_node, prop_name);
> + if (count <= 0)
> + return count ? count : -ENOENT;
>
Hi Can,
Returning -ENOENT when count == 0 is not correct.
count == 0 means "empty property," whereas -ENOENT means "property
not present."
I suggest only checking for < 0 as follows:
if (count < 0)
return count;
and letting the count == 0 case be handled below:
if (count != num_elems) {
...
return -EINVAL;
}
Best Regards,
Can Guo.
Thanks.
Peter
> +
> + if (count != num_elems) {
> + dev_err(dev, "Property %s has invalid count (%d),
> expecting %u\n",
> + prop_name, count, num_elems);
> + return -EINVAL;
> + }
************* MEDIATEK Confidentiality Notice
********************
The information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be
conveyed only to the designated recipient(s). Any use, dissemination,
distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or believe
that you have received this e-mail in error, please notify the sender
immediately (by replying to this e-mail), delete any and all copies of
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!