On 09/07/2018 09:42 AM, Ley Foon Tan wrote:
> Disable and free clock when remove driver.
> 
> Signed-off-by: Ley Foon Tan <ley.foon....@intel.com>
> ---
>  drivers/spi/designware_spi.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
> index 5cca414..f4d36cf 100644
> --- a/drivers/spi/designware_spi.c
> +++ b/drivers/spi/designware_spi.c
> @@ -516,8 +516,20 @@ static int dw_spi_set_mode(struct udevice *bus, uint 
> mode)
>  static int dw_spi_remove(struct udevice *bus)
>  {
>       struct dw_spi_priv *priv = dev_get_priv(bus);
> +     int ret;
>  
> -     return reset_release_bulk(&priv->resets);
> +     ret = reset_release_bulk(&priv->resets);
> +     if (ret)
> +             return ret;
> +
> +#if CONFIG_IS_ENABLED(CLK)
> +     ret = clk_disable(&priv->clk);
> +     if (ret)
> +             return ret;
> +
> +     ret = clk_free(&priv->clk);
> +#endif

With CONFIG_CLK = n, you basically get

ret = reset_release_bulk();
if (ret)
  return ret;

return ret;

Just check the return value from clk_free() with if (ret) and then
finally return 0;


ret = reset_release_bulk();
if (ret)
  return ret;

#if ....
ret = clk_...
if (ret)
  return ret;
...
#endif

return 0;

> +     return ret;
>  }
>  
>  static const struct dm_spi_ops dw_spi_ops = {
> 


-- 
Best regards,
Marek Vasut
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to