Hello, found another suspicious area regarding pm_runtime in atmel_qspi_probe(), see below (irrelevant stuff dropped this time) … Am Thu, Nov 28, 2024 at 06:43:15PM +0100 schrieb Csókás, Bence: > From: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx> > […] > @@ -726,18 +1411,32 @@ static int atmel_qspi_probe(struct platform_device *pdev) > "failed to enable the QSPI system clock\n"); > goto disable_pclk; > } > + } else if (aq->caps->has_gclk) { > + /* Get the QSPI generic clock */ > + aq->gclk = devm_clk_get(&pdev->dev, "gclk"); > + if (IS_ERR(aq->gclk)) { > + dev_err(&pdev->dev, "missing Generic clock\n"); > + err = PTR_ERR(aq->gclk); > + goto disable_pclk; > + } > + } > + > + if (aq->caps->has_dma) { > + err = atmel_qspi_dma_init(ctrl); > + if (err == -EPROBE_DEFER) > + goto disable_qspick; > } > > /* Request the IRQ */ > irq = platform_get_irq(pdev, 0); > if (irq < 0) { > err = irq; > - goto disable_qspick; > + goto dma_release; > } > err = devm_request_irq(&pdev->dev, irq, atmel_qspi_interrupt, > 0, dev_name(&pdev->dev), aq); > if (err) > - goto disable_qspick; > + goto dma_release; > > pm_runtime_set_autosuspend_delay(&pdev->dev, 500); > pm_runtime_use_autosuspend(&pdev->dev); > @@ -745,7 +1444,9 @@ static int atmel_qspi_probe(struct platform_device *pdev) > pm_runtime_enable(&pdev->dev); > pm_runtime_get_noresume(&pdev->dev); > > - atmel_qspi_init(aq); > + err = atmel_qspi_init(aq); > + if (err) > + goto dma_release; This error handling leads to unbalanced pm_runtime right? The block below rolls back pm_runtime before jumping to 'dma_release', this here does not. > err = spi_register_controller(ctrl); > if (err) { > @@ -753,13 +1454,16 @@ static int atmel_qspi_probe(struct platform_device *pdev) > pm_runtime_disable(&pdev->dev); > pm_runtime_set_suspended(&pdev->dev); > pm_runtime_dont_use_autosuspend(&pdev->dev); > - goto disable_qspick; > + goto dma_release; > } This hunk got it right? > pm_runtime_mark_last_busy(&pdev->dev); > pm_runtime_put_autosuspend(&pdev->dev); > > return 0; > > +dma_release: > + if (aq->caps->has_dma) > + atmel_qspi_dma_release(aq); > disable_qspick: > clk_disable_unprepare(aq->qspick); > disable_pclk: > @@ -768,6 +1472,44 @@ static int atmel_qspi_probe(struct platform_device *pdev) > return err; > } I think this is another issue of forwarding porting. The pm_runtime stuff was added in mainline after the original patch was forked of, and not entirely considered when porting? Greets Alex