mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linmao Li <lilinmao@kylinos.cn>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux@analog.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] iio: adc: ade9000: fix NULL pointer dereference in clkout registration
Date: Wed, 26 Aug 2026 10:24:18 +0800	[thread overview]
Message-ID: <d8d17463-cde2-47a0-9e18-ffa5d8cab52b@kylinos.cn> (raw)
In-Reply-To: <aoxecT3hNa-M3UMn@ashevche-desk.local>


在 2026/8/24 23:08, Andy Shevchenko 写道:
> On Mon, Aug 24, 2026 at 08:52:10PM +0800, Linmao Li wrote:
>> ade9000_setup_clkout() passes NULL as the register address when
>> registering a divider clock. During clock registration, the common
>> clock framework calls clk_divider_recalc_rate(), which dereferences
>> the address through readl(). As a result, probing an ADE9000 configured
>> as a clock provider with an external input clock crashes.
>>
>> CLKOUT passes CLKIN through without changing its rate. Register it as
>> a 1:1 fixed-factor clock, which does not require register access.
> Do you have HW to test? What will be the result for the internal clock case?
No, unfortunately I do not have access to the hardware, so this is
based on code inspection only.

For the crystal oscillator case, the device tree does not provide a
clocks property. devm_clk_get_optional_enabled() therefore returns
NULL, and ade9000_setup_clkout() returns here:

         if (!device_property_present(dev, "#clock-cells") || !st->clkin)
                 return 0;

No clock provider is registered in that case. This behavior is
unchanged by the patch. The modified registration path is reached only
when an external input clock is present and the device is configured as
a clock provider.

Thanks,
Linmao
>

  reply	other threads:[~2026-08-26  2:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 12:52 Linmao Li
2026-08-24 15:08 ` Andy Shevchenko
2026-08-26  2:24   ` Linmao Li [this message]
2026-08-26  7:23     ` Andy Shevchenko

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=d8d17463-cde2-47a0-9e18-ffa5d8cab52b@kylinos.cn \
    --to=lilinmao@kylinos.cn \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=stable@vger.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®