devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Praveen Talari <praveen.talari@oss.qualcomm.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Dmitry Baryshkov <lumag@kernel.org>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-serial@vger.kernel.org, alexey.klimov@linaro.org,
	krzk@kernel.org, bryan.odonoghue@linaro.org,
	jorge.ramirez@oss.qualcomm.com,
	dmitry.baryshkov@oss.qualcomm.com,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	psodagud@quicinc.com, djaggi@quicinc.com,
	quic_msavaliy@quicinc.com, quic_vtanuku@quicinc.com,
	quic_arandive@quicinc.com, quic_shazhuss@quicinc.com,
	quic_cchiluve@quicinc.com
Subject: Re: [PATCH v1 4/4] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms
Date: Wed, 26 Nov 2025 14:06:38 +0100	[thread overview]
Message-ID: <aSb7XhbTTtF3Wd-3@black.igk.intel.com> (raw)
In-Reply-To: <20251110101043.2108414-5-praveen.talari@oss.qualcomm.com>

On Mon, Nov 10, 2025 at 03:40:43PM +0530, Praveen Talari wrote:
> The Qualcomm automotive SA8255p SoC relies on firmware to configure
> platform resources, including clocks, interconnects and TLMM.
> The driver requests resources operations over SCMI using power
> and performance protocols.
> 
> The SCMI power protocol enables or disables resources like clocks,
> interconnect paths, and TLMM (GPIOs) using runtime PM framework APIs,
> such as resume/suspend, to control power states(on/off).
> 
> The SCMI performance protocol manages UART baud rates, with each baud
> rate represented by a performance level. The driver uses the
> dev_pm_opp_set_level() API to request the desired baud rate by
> specifying the performance level.

...

> +static int geni_serial_pwr_init(struct uart_port *uport)
> +{
> +	struct qcom_geni_serial_port *port = to_dev_port(uport);
> +	int ret;
> +
> +	ret = dev_pm_domain_attach_list(port->se.dev,
> +					&port->dev_data->pd_data, &port->pd_list);
> +	if (ret <= 0)
> +		return -EINVAL;
> +
> +	return 0;

Why shadowing an error code?

This should be

	ret = dev_pm_domain_attach_list(port->se.dev,
					&port->dev_data->pd_data, &port->pd_list);
	if (ret < 0)
		return ret; // assuming it returns a Linux err code.
	/* Some comment, perhaps? */
	if (ret == 0)
		return -EINVAL;

	return 0;

> +}

...

>  		port->rx_buf = devm_kzalloc(uport->dev,
>  					    DMA_RX_BUF_SIZE, GFP_KERNEL);
> -		if (!port->rx_buf)
> -			return -ENOMEM;
> +		if (!port->rx_buf) {
> +			ret = -ENOMEM;
> +			goto error;

This is wrong. After devm_*() calls should not be goto:s. It should be very
exceptional cases otherwise.

> +		}

...

>  	port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
>  			"qcom_geni_serial_%s%d",
>  			uart_console(uport) ? "console" : "uart", uport->line);
> -	if (!port->name)
> -		return -ENOMEM;
> +	if (!port->name) {
> +		ret = -ENOMEM;
> +		goto error;
> +	}

Ditto.

...

> +	if (irq < 0) {
> +		ret = irq;
> +		goto error;

Ditto. And so on...

> +	}

...

Hint: use devm_add_action_or_reset() above and drop most of the changes in this
patch.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-11-26 13:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 10:10 [PATCH v1 0/4] Enable Serial on SA8255p Qualcomm platforms Praveen Talari
2025-11-10 10:10 ` [PATCH v1 1/4] arm64: dts: qcom: qrb2210-rb1: Fix UART3 wakeup IRQ storm Praveen Talari
2025-11-10 11:10   ` Konrad Dybcio
2025-11-10 10:10 ` [PATCH v1 2/4] pinctrl: qcom: msm: Fix potential deadlock in pinmux configuration Praveen Talari
2025-11-11  4:08   ` Bjorn Andersson
2025-11-11  5:22     ` Praveen Talari
2025-11-11 15:35       ` Bjorn Andersson
2025-11-12 12:43   ` Linus Walleij
2025-11-10 10:10 ` [PATCH v1 3/4] serial: qcom-geni: Enable PM runtime for serial driver Praveen Talari
2025-11-26 13:01   ` Andy Shevchenko
2025-12-30 18:23   ` Dmitry Baryshkov
2025-12-31  3:00     ` Praveen Talari
2025-12-31  3:00       ` Dmitry Baryshkov
2025-12-31  5:49         ` Praveen Talari
2025-12-31  5:51           ` Dmitry Baryshkov
2025-11-10 10:10 ` [PATCH v1 4/4] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms Praveen Talari
2025-11-26 13:06   ` Andy Shevchenko [this message]
2025-11-14  0:18 ` (subset) [PATCH v1 0/4] " Bjorn Andersson

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=aSb7XhbTTtF3Wd-3@black.igk.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=alexey.klimov@linaro.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djaggi@quicinc.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=jorge.ramirez@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=praveen.talari@oss.qualcomm.com \
    --cc=psodagud@quicinc.com \
    --cc=quic_arandive@quicinc.com \
    --cc=quic_cchiluve@quicinc.com \
    --cc=quic_msavaliy@quicinc.com \
    --cc=quic_shazhuss@quicinc.com \
    --cc=quic_vtanuku@quicinc.com \
    --cc=robh@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;
as well as URLs for NNTP newsgroup(s).