Re: [PATCH v2] mmc: sdhci-xenon: Fix clock resource by adding an optional bus clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Sat, 30 Sep 2017 10:41:09 +0800, Jisheng Zhang wrote:

> > +	priv->axi_clk = devm_clk_get(&pdev->dev, "axi");
> > +	if (IS_ERR(priv->axi_clk)) {
> > +		err = PTR_ERR(priv->axi_clk);
> > +		if (err == -EPROBE_DEFER)
> > +			goto err_clk;
> > +		priv->axi_clk = NULL;  
> 
> IMHO, this assignment could be removed. What do you think?

No, because if the clock is not present in the Device Tree,
priv->axi_clk will contain an error code encoded as a pointer, so
priv->axi_clk will not be NULL. Hence the rest of the code that will
operate on this clock will believe there is a valid clock pointed by
priv->axi_clk. So we really want to reset it to NULL when there was an
error getting the clock.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]