mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "beanhuo@micron.com" <beanhuo@micron.com>,
	"mani@kernel.org" <mani@kernel.org>,
	"can.guo@oss.qualcomm.com" <can.guo@oss.qualcomm.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"quic_nitirawa@quicinc.com" <quic_nitirawa@quicinc.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"quic_rdwivedi@quicinc.com" <quic_rdwivedi@quicinc.com>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v7 2/2] scsi: ufs: core: Add support for static TX Equalization settings
Date: Thu, 11 Jun 2026 10:11:05 +0000	[thread overview]
Message-ID: <5a1e01dda55af091204c430ff383c97c8dd69ed6.camel@mediatek.com> (raw)
In-Reply-To: <20260610071516.3763916-3-can.guo@oss.qualcomm.com>

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;
}

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;
> +       }


  parent reply	other threads:[~2026-06-11 10:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260610071516.3763916-1-can.guo@oss.qualcomm.com>
2026-06-10  7:15 ` [PATCH v7 1/2] dt-bindings: ufs: Document static TX Equalization settings properties Can Guo
2026-06-11 13:32   ` Krzysztof Kozlowski
2026-06-11 14:14     ` Can Guo
2026-06-10  7:15 ` [PATCH v7 2/2] scsi: ufs: core: Add support for static TX Equalization settings Can Guo
2026-06-10 20:08   ` Bart Van Assche
2026-06-11  1:26     ` Can Guo
2026-06-11 10:11   ` Peter Wang (王信友) [this message]
2026-06-11 14:15     ` Can Guo

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=5a1e01dda55af091204c430ff383c97c8dd69ed6.camel@mediatek.com \
    --to=peter.wang@mediatek.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=can.guo@oss.qualcomm.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_rdwivedi@quicinc.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®