public inbox for imx@lists.linux.dev
 help / color / mirror / Atom feed
From: Frank Li <Frank.Li@nxp.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Li Jun <jun.li@nxp.com>,
	Badhri Jagan Sridharan <badhri@google.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Frank Li <frank.li@nxp.com>,
	linux-usb@vger.kernel.org, imx@lists.linux.dev,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xu Yang <xu.yang_2@nxp.com>
Subject: Re: [PATCH 2/2] usb: typec: tcpci: support setting orientation via GPIO
Date: Tue, 10 Mar 2026 14:34:00 -0400	[thread overview]
Message-ID: <20260310183401.2228714-1-Frank.Li@nxp.com> (raw)
In-Reply-To: <20260310-support-setting-orientation-use-gpio-v1-2-da31dc6cd641@nxp.com>

From: Frank Li (AI-BOT) <frank.li@nxp.com>

> +	if (err == 0) {
> +		orient_gpio = devm_gpiod_get_optional(&client->dev, "orientation",
> +						      GPIOD_OUT_LOW);
> +		if (IS_ERR(orient_gpio))
> +			return dev_err_probe(&client->dev, PTR_ERR(orient_gpio),
> +					"unable to acquire orientation gpio\n");
> +		err = !!orient_gpio;
> +	}

AI: The logic here is confusing. You're converting a pointer to a boolean with
`!!orient_gpio`, then assigning it to `err`. This overwrites the error code
and makes the intent unclear. Consider using a separate flag variable or
restructuring to keep error handling explicit.

> +	chip->tcpci->orientation_gpio = orient_gpio;
> +
> +	err = devm_request_threaded_irq(&client->dev, client->irq, NULL,

AI: This assignment happens after `tcpci_register_port()` returns. If that
function or any subsequent code path fails before this line, the GPIO
pointer is never stored in the chip structure. Consider moving the
assignment immediately after the GPIO acquisition, or ensure the pointer
is initialized in the struct at declaration time.

Frank

      reply	other threads:[~2026-03-10 18:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  8:13 [PATCH 0/2] usb: typec: tcpci: support setting orientation via GPIO Xu Yang
2026-03-10  8:13 ` [PATCH 1/2] dt-bindings: usb: nxp,ptn5110: add optional orientation-gpio property Xu Yang
2026-03-11 12:59   ` Krzysztof Kozlowski
2026-03-11 15:06     ` Xu Yang
2026-03-11 13:00   ` Krzysztof Kozlowski
2026-03-11 15:19     ` Xu Yang
2026-03-11 15:28       ` Krzysztof Kozlowski
2026-03-10  8:13 ` [PATCH 2/2] usb: typec: tcpci: support setting orientation via GPIO Xu Yang
2026-03-10 18:34   ` Frank Li [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=20260310183401.2228714-1-Frank.Li@nxp.com \
    --to=frank.li@nxp.com \
    --cc=badhri@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=imx@lists.linux.dev \
    --cc=jun.li@nxp.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=xu.yang_2@nxp.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