mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <shao.mingyin@zte.com.cn>
To: <jelonek.jonas@gmail.com>
Cc: <linusw@kernel.org>, <brgl@kernel.org>,
	<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<geert+renesas@glider.be>, <andrew@codeconstruct.com.au>,
	<wbg@kernel.org>, <opendmb@gmail.com>,
	<florian.fainelli@broadcom.com>,
	<bcm-kernel-feedback-list@broadcom.com>
Subject: Re: [PATCH 5/5] gpio: line-mux: fix unsigned truncation of property count error
Date: Mon, 9 Nov 2026 18:21:47 +0800 (CST)	[thread overview]
Message-ID: <20261109182147347ZmJrB3jgSM0GHweaMxJm7@zte.com.cn> (raw)
In-Reply-To: <c9e116f6-ce3c-4cda-83dc-4e96c7d58aa8@gmail.com>

On Mon, 2026-11-09 at 09:29 +0100, Jonas Jelonek wrote:
> Nit: Please adjust to keep reverse christmas tree. I think 'int ret' and
> 'int ngpio' can be merged too.

Right — shrinking "unsigned int ngpio" to "int ngpio" put that line
before "size_t size" and broke the reverse christmas tree ordering.
I'll merge the two ints and keep the longest-first order:

	struct device *dev = &pdev->dev;
	struct gpio_lmux *glm;
	size_t size;
	int ngpio, ret;

> Maybe return the error if < 0, instead of -EINVAL for all?

Agreed. device_property_count_u32() can also return -ENODATA, -EPROTO,
-EOVERFLOW or -ENXIO, and folding them all into -EINVAL would hide which
one failed. I'll propagate the errno and only map a zero count to
-EINVAL:

	ngpio = device_property_count_u32(dev, "gpio-line-mux-states");
	if (ngpio < 0)
		return ngpio;
	if (!ngpio)
		return -EINVAL;

I'll repost as v2 with your Reviewed-by.

Best,
Shao Mingyin

      reply	other threads:[~2026-11-09 10:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07  8:12 [PATCH 0/5] gpio: fix IRQ handling and probe error paths in five drivers shao.mingyin
2026-11-07  8:12 ` [PATCH 1/5] gpio: rcar: don't clobber INTMSK when disabling a single line shao.mingyin
2026-11-09 14:40   ` Geert Uytterhoeven
2026-11-09 14:57     ` shao.mingyin
2026-11-07  8:12 ` [PATCH 2/5] gpio: aspeed-sgpio: propagate IRQ setup error in probe shao.mingyin
2026-11-09  3:55   ` Andrew Jeffery
2026-11-07  8:12 ` [PATCH 3/5] gpio: 104-idi-48: fix max_register blocking the IRQ register shao.mingyin
2026-11-07 20:19   ` William Breathitt Gray
2026-11-07  8:12 ` [PATCH 4/5] gpio: brcmstb: don't turn platform_get_irq errors into -ENOENT shao.mingyin
2026-11-10  4:39   ` Florian Fainelli
2026-11-07  8:12 ` [PATCH 5/5] gpio: line-mux: fix unsigned truncation of property count error shao.mingyin
2026-11-09  8:29   ` Jonas Jelonek
2026-11-09 10:21     ` shao.mingyin [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=20261109182147347ZmJrB3jgSM0GHweaMxJm7@zte.com.cn \
    --to=shao.mingyin@zte.com.cn \
    --cc=andrew@codeconstruct.com.au \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=brgl@kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=geert+renesas@glider.be \
    --cc=jelonek.jonas@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=wbg@kernel.org \
    /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®