[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <843fab4d-0fdd-4610-91ed-1d8e9accbd25@lunn.ch>
Date: Sun, 16 Apr 2023 17:33:19 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Wang Zhang <silver_code@...t.edu.cn>
Cc: Peter Korsgaard <peter@...sgaard.com>,
Dongliang Mu <dzm91@...t.edu.cn>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i2c: ocores: add missing unwind goto in
`ocores_i2c_probe`
On Sun, Apr 16, 2023 at 03:20:40PM +0800, Wang Zhang wrote:
> platform_get_irq_optional is a function used to obtain an IRQ
> number for a device on a platform. The function returns the IRQ number
> associated with the specified device, or a negative error code if it fails.
>
> The error handling code after the err_clk label should be executed to
> release any resources that were allocated for the clock if a negative
> error code returned.
>
> Fix this by assigning irq to ret and changing the direct return to err_clk.
The clock is got in ocores_i2c_of_probe(). That function is not always
called. So you need to be careful in the error handling that you are
not disabling a clock which does not exist....
But i think a better fix is to change ocores_i2c_of_probe() to use
devm_clk_get_enabled(), rather than devm_clk_get() so that the driver
core will disable to clock if the probe fails, or when the driver is
unloaded.
Andrew
Powered by blists - more mailing lists