Re: [PATCHv2] gpio: mvebu: use devm_clk_get_optional_enabled()
From: Andrew Lunn
Date: Wed Jul 08 2026 - 19:40:45 EST
On Wed, Jul 08, 2026 at 03:48:22PM -0700, Rosen Penev wrote:
> The clock is obtained without doing any sort of cleanup on remove or
> anywhere else.
Didn't you say you could not unload this driver? Then why is cleanup
needed?
> Use the proper function to handle this. When it fails
> with -EPROBE_DEFER for example, return so that it can be handled.
Why would it fail with -EPROBE_DEFER? The only resource this driver
needs is optional clocks. If the SoC clock driver is missing, the SoC
is going to die very soon anyway, it is such a core part of the SoC.
If you access any register without the clock enabled, the SoC just
hard wedges. I've had to debug that situation.
> When
> the clock is not found, it's NULL and not a PTR_ERR. Handle that as
> well.
/**
* devm_clk_get - lookup and obtain a managed reference to a clock producer.
* @dev: device for clock "consumer"
* @id: clock consumer ID
*
* Context: May sleep.
*
* Return: a struct clk corresponding to the clock producer, or
* valid IS_ERR() condition containing errno.
The documentation disagrees with you.
Please take a step back. What is really broken here? What reports are
there from users? What is bothering people?
Andrew