summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorLinmao Li <lilinmao@kylinos.cn>2026-08-26 16:31:56 +0800
committerJonathan Cameron <jonathan.cameron@oss.qualcomm.com>2026-09-30 18:59:55 +0100
commit49ee1c6a3ebda6b7de06b2961b0e09c1c3fe536a (patch)
tree77cc0c56c78d222432802667b26d89c3bf65fc07 /drivers/iio
parentd615210564205993e8f0e7ccb57cc2e66b7d5706 (diff)
downloadlinux-stable-49ee1c6a3ebda6b7de06b2961b0e09c1c3fe536a.tar.gz
linux-stable-49ee1c6a3ebda6b7de06b2961b0e09c1c3fe536a.zip
iio: adc: ade9000: fix NULL pointer dereference in clkout registration
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. This change does not affect the configuration using the internal clock, for which the driver does not register a clock provider. Fixes: 81de7b4619fc ("iio: adc: add ade9000 support") Cc: stable@vger.kernel.org Signed-off-by: Linmao Li <lilinmao@kylinos.cn> Reviewed-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/ade9000.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
index da6caabfe..4fc0eb7e7 100644
--- a/drivers/iio/adc/ade9000.c
+++ b/drivers/iio/adc/ade9000.c
@@ -1647,8 +1647,9 @@ static int ade9000_setup_clkout(struct device *dev, struct ade9000_state *st)
return 0;
/* CLKOUT passes through CLKIN with divider of 1 */
- clkout_hw = devm_clk_hw_register_divider(dev, "clkout", __clk_get_name(st->clkin),
- CLK_SET_RATE_PARENT, NULL, 0, 1, 0, NULL);
+ clkout_hw = devm_clk_hw_register_fixed_factor(dev, "clkout",
+ __clk_get_name(st->clkin),
+ CLK_SET_RATE_PARENT, 1, 1);
if (IS_ERR(clkout_hw))
return dev_err_probe(dev, PTR_ERR(clkout_hw), "Failed to register clkout");