Re: [PATCH 5.4 007/320] mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings

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

 



Hi Pavel,

On Monday, 24 January 2022, 21:41:48 CET, Pavel Machek wrote:
> Hi!
> 
> > commit f53d4c109a666bf1a4883b45d546fba079258717 upstream.
> > 
> > gpmi_io clock needs to be gated off when changing the parent/dividers of
> > enfc_clk_root (i.MX6Q/i.MX6UL) respectively qspi2_clk_root (i.MX6SX).
> > Otherwise this rate change can lead to an unresponsive GPMI core which
> > results in DMA timeouts and failed driver probe:
> ...
> 
> > @@ -2429,7 +2449,9 @@ static int gpmi_nfc_exec_op(struct nand_
> >  	 */
> >  	if (this->hw.must_apply_timings) {
> >  		this->hw.must_apply_timings = false;
> > -		gpmi_nfc_apply_timings(this);
> > +		ret = gpmi_nfc_apply_timings(this);
> > +		if (ret)
> > +			return ret;
> >  	}
> >  
> >  	dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);
> >
> 
> AFAICT this leaks pm reference in the error case. Not sure what
> variant is right, there, so...
You're right, thanks for pointing this out. I think that the error path
currently should not appear in practice, but I plan to add further patches
in future where this could happen then.

Although there's a potential new error, I think that this patch should
improve the situation.

> 
> Best regards,
> 								Pavel
> 
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 1b64c5a5140d..06840cff6945 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -2284,8 +2284,10 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
>  	if (this->hw.must_apply_timings) {
>  		this->hw.must_apply_timings = false;
>  		ret = gpmi_nfc_apply_timings(this);
> -		if (ret)
> +		if (ret) {
> +			pm_runtime_put_....(this->dev);
>  			return ret;
> +		}
>  	}
>  
>  	dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);

I'll prepare and send a new patch tomorrow.

regards
Christian







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

  Powered by Linux