ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mikhail Kalashnikov" <iuncuim@gmail.com>
Cc: devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 3/5] thermal/drivers/sun8i: get calibration data from two nvmem cells
Date: Fri, 04 Dec 2026 10:58:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-249647@kernel.org> (raw)
In-Reply-To: <883618c8962e1457a9dbefe500ac9ceefc4cc67b.1796378254.git.iuncuim@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] thermal/sun8i: dead nvmem_cell_put() at out label in
  sun8i_ths_calibrate()
--

commit 868b0257ac69107a99481c39419164e961cf6b23
Author: Mikhail Kalashnikov <iuncuim@gmail.com>

thermal/drivers/sun8i: get calibration data from two nvmem cells

This commit updates sun8i_ths_calibrate() to iterate over all entries in
the nvmem-cell-names property and concatenate their calibration data into
a single buffer.

> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 1412bce630c0c..3606548801f02 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -300,43 +300,68 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev,
>  
>  static int sun8i_ths_calibrate(struct ths_device *tmdev)
>  {
> -	struct nvmem_cell *calcell;
> +	struct nvmem_cell *calcell = NULL;

[ ... ]

> +		caldatapart = nvmem_cell_read(calcell, &len);
> +		nvmem_cell_put(calcell);
> +		calcell = NULL;
> +		if (IS_ERR(caldatapart)) {
> +			ret = PTR_ERR(caldatapart);
> +			goto out;
> +		}

[ ... ]

>  out:
> -	if (!IS_ERR(calcell))
> +	if (!IS_ERR_OR_NULL(calcell))
>  		nvmem_cell_put(calcell);
>  	return ret;
>  }

[Severity: Low]
Can this nvmem_cell_put() at the out label ever run?  Every successful
of_nvmem_cell_get() is immediately followed by nvmem_cell_put() and
calcell = NULL, so calcell is always NULL or an ERR_PTR on reaching out,
making this cleanup branch dead code.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796378254.git.iuncuim@gmail.com?part=3

  reply	other threads:[~2026-12-04 10:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 10:43 [PATCH v7 0/5] Allwinner: A523: add support for A523 THS0/1 controllers Mikhail Kalashnikov
2026-12-04 10:43 ` [PATCH v7 1/5] dt-bindings: thermal: sun8i: Add " Mikhail Kalashnikov
2026-12-04 10:43 ` [PATCH v7 2/5] thermal/drivers/sun8i: replace devm_reset_control_get to devm_reset_control_get_shared_deasserted Mikhail Kalashnikov
2026-12-04 10:43 ` [PATCH v7 3/5] thermal/drivers/sun8i: get calibration data from two nvmem cells Mikhail Kalashnikov
2026-12-04 10:58   ` sashiko-bot [this message]
2026-12-04 10:43 ` [PATCH v7 4/5] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers Mikhail Kalashnikov
2026-12-04 11:02   ` sashiko-bot
2026-12-04 10:43 ` [PATCH v7 5/5] arm64: dts: allwinner: sun55i: add thermal sensors Mikhail Kalashnikov
2026-12-04 11:02   ` sashiko-bot

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=sashiko-outbox-249647@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=iuncuim@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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