* [PATCH 0/2] spi: stm32-qspi: rework probe error path @ 2020-02-03 13:50 patrice.chotard-qxv4g6HH51o [not found] ` <20200203135048.1299-1-patrice.chotard-qxv4g6HH51o@public.gmane.org> 2020-02-03 13:50 ` [PATCH 2/2] spi: stm32-qspi: properly manage probe errors patrice.chotard 0 siblings, 2 replies; 5+ messages in thread From: patrice.chotard-qxv4g6HH51o @ 2020-02-03 13:50 UTC (permalink / raw) To: Mark Brown, Maxime Coquelin, Alexandre Torgue, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: patrice.chotard-qxv4g6HH51o, christophe.kerello-qxv4g6HH51o From: Patrice Chotard <patrice.chotard-qxv4g6HH51o@public.gmane.org> This series is fixing the probe error path of spi-stm32-qspi driver: - it allows to defer probe if reset controller driver is not yet probed. - if fixes the error path in releasing only allocated ressouces in case of error. Etienne Carriere (1): spi: stm32-qspi: defer probe for reset controller Lionel Debieve (1): spi: stm32-qspi: properly manage probe errors drivers/spi/spi-stm32-qspi.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20200203135048.1299-1-patrice.chotard-qxv4g6HH51o@public.gmane.org>]
* [PATCH 1/2] spi: stm32-qspi: defer probe for reset controller [not found] ` <20200203135048.1299-1-patrice.chotard-qxv4g6HH51o@public.gmane.org> @ 2020-02-03 13:50 ` patrice.chotard-qxv4g6HH51o 2020-02-11 15:51 ` Applied "spi: stm32-qspi: defer probe for reset controller" to the spi tree Mark Brown 0 siblings, 1 reply; 5+ messages in thread From: patrice.chotard-qxv4g6HH51o @ 2020-02-03 13:50 UTC (permalink / raw) To: Mark Brown, Maxime Coquelin, Alexandre Torgue, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: patrice.chotard-qxv4g6HH51o, christophe.kerello-qxv4g6HH51o, Etienne Carriere From: Etienne Carriere <etienne.carriere-qxv4g6HH51o@public.gmane.org> Changes stm32 QSPI driver to defer its probe operation when a reset controller device have not yet probed but is registered in the system. Signed-off-by: Etienne Carriere <etienne.carriere-qxv4g6HH51o@public.gmane.org> Signed-off-by: Patrice Chotard <patrice.chotard-qxv4g6HH51o@public.gmane.org> --- drivers/spi/spi-stm32-qspi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index 4ef569b47aa6..13bb64bf4c8f 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -615,7 +615,11 @@ static int stm32_qspi_probe(struct platform_device *pdev) } rstc = devm_reset_control_get_exclusive(dev, NULL); - if (!IS_ERR(rstc)) { + if (IS_ERR(rstc)) { + ret = PTR_ERR(rstc); + if (ret == -EPROBE_DEFER) + goto err; + } else { reset_control_assert(rstc); udelay(2); reset_control_deassert(rstc); -- 2.17.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Applied "spi: stm32-qspi: defer probe for reset controller" to the spi tree 2020-02-03 13:50 ` [PATCH 1/2] spi: stm32-qspi: defer probe for reset controller patrice.chotard-qxv4g6HH51o @ 2020-02-11 15:51 ` Mark Brown 0 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2020-02-11 15:51 UTC (permalink / raw) To: Etienne Carriere Cc: Alexandre Torgue, christophe.kerello, linux-arm-kernel, linux-kernel, linux-spi, linux-stm32, Mark Brown, Maxime Coquelin, Patrice Chotard, patrice.chotard The patch spi: stm32-qspi: defer probe for reset controller has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.7 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 8196f7bcc2adf21f83d82691d537fcef7abaa1c7 Mon Sep 17 00:00:00 2001 From: Etienne Carriere <etienne.carriere@st.com> Date: Mon, 3 Feb 2020 14:50:47 +0100 Subject: [PATCH] spi: stm32-qspi: defer probe for reset controller Changes stm32 QSPI driver to defer its probe operation when a reset controller device have not yet probed but is registered in the system. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Link: https://lore.kernel.org/r/20200203135048.1299-2-patrice.chotard@st.com Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/spi/spi-stm32-qspi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index 4ef569b47aa6..13bb64bf4c8f 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -615,7 +615,11 @@ static int stm32_qspi_probe(struct platform_device *pdev) } rstc = devm_reset_control_get_exclusive(dev, NULL); - if (!IS_ERR(rstc)) { + if (IS_ERR(rstc)) { + ret = PTR_ERR(rstc); + if (ret == -EPROBE_DEFER) + goto err; + } else { reset_control_assert(rstc); udelay(2); reset_control_deassert(rstc); -- 2.20.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] spi: stm32-qspi: properly manage probe errors 2020-02-03 13:50 [PATCH 0/2] spi: stm32-qspi: rework probe error path patrice.chotard-qxv4g6HH51o [not found] ` <20200203135048.1299-1-patrice.chotard-qxv4g6HH51o@public.gmane.org> @ 2020-02-03 13:50 ` patrice.chotard 2020-02-11 15:51 ` Applied "spi: stm32-qspi: properly manage probe errors" to the spi tree Mark Brown 1 sibling, 1 reply; 5+ messages in thread From: patrice.chotard @ 2020-02-03 13:50 UTC (permalink / raw) To: Mark Brown, Maxime Coquelin, Alexandre Torgue, linux-spi, linux-stm32, linux-arm-kernel, linux-kernel Cc: patrice.chotard, christophe.kerello, Lionel Debieve, Etienne Carriere From: Lionel Debieve <lionel.debieve@st.com> Fix resource release issues when driver probe operation fails. Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> --- drivers/spi/spi-stm32-qspi.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index 13bb64bf4c8f..d066f5144c3e 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -565,7 +565,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) qspi->io_base = devm_ioremap_resource(dev, res); if (IS_ERR(qspi->io_base)) { ret = PTR_ERR(qspi->io_base); - goto err; + goto err_master_put; } qspi->phys_base = res->start; @@ -574,24 +574,26 @@ static int stm32_qspi_probe(struct platform_device *pdev) qspi->mm_base = devm_ioremap_resource(dev, res); if (IS_ERR(qspi->mm_base)) { ret = PTR_ERR(qspi->mm_base); - goto err; + goto err_master_put; } qspi->mm_size = resource_size(res); if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) { ret = -EINVAL; - goto err; + goto err_master_put; } irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + if (irq < 0) { + ret = irq; + goto err_master_put; + } ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0, dev_name(dev), qspi); if (ret) { dev_err(dev, "failed to request irq\n"); - goto err; + goto err_master_put; } init_completion(&qspi->data_completion); @@ -599,26 +601,26 @@ static int stm32_qspi_probe(struct platform_device *pdev) qspi->clk = devm_clk_get(dev, NULL); if (IS_ERR(qspi->clk)) { ret = PTR_ERR(qspi->clk); - goto err; + goto err_master_put; } qspi->clk_rate = clk_get_rate(qspi->clk); if (!qspi->clk_rate) { ret = -EINVAL; - goto err; + goto err_master_put; } ret = clk_prepare_enable(qspi->clk); if (ret) { dev_err(dev, "can not enable the clock\n"); - goto err; + goto err_master_put; } rstc = devm_reset_control_get_exclusive(dev, NULL); if (IS_ERR(rstc)) { ret = PTR_ERR(rstc); if (ret == -EPROBE_DEFER) - goto err; + goto err_qspi_release; } else { reset_control_assert(rstc); udelay(2); @@ -629,7 +631,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, qspi); ret = stm32_qspi_dma_setup(qspi); if (ret) - goto err; + goto err_qspi_release; mutex_init(&qspi->lock); @@ -645,8 +647,9 @@ static int stm32_qspi_probe(struct platform_device *pdev) if (!ret) return 0; -err: +err_qspi_release: stm32_qspi_release(qspi); +err_master_put: spi_master_put(qspi->ctrl); return ret; -- 2.17.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Applied "spi: stm32-qspi: properly manage probe errors" to the spi tree 2020-02-03 13:50 ` [PATCH 2/2] spi: stm32-qspi: properly manage probe errors patrice.chotard @ 2020-02-11 15:51 ` Mark Brown 0 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2020-02-11 15:51 UTC (permalink / raw) To: Lionel Debieve Cc: Alexandre Torgue, christophe.kerello, Etienne Carriere, linux-arm-kernel, linux-kernel, linux-spi, linux-stm32, Mark Brown, Maxime Coquelin, Patrice Chotard, patrice.chotard The patch spi: stm32-qspi: properly manage probe errors has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.7 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 4a08d6c8662472121b0ddc29180ab3c94c34f586 Mon Sep 17 00:00:00 2001 From: Lionel Debieve <lionel.debieve@st.com> Date: Mon, 3 Feb 2020 14:50:48 +0100 Subject: [PATCH] spi: stm32-qspi: properly manage probe errors Fix resource release issues when driver probe operation fails. Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Link: https://lore.kernel.org/r/20200203135048.1299-3-patrice.chotard@st.com Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/spi/spi-stm32-qspi.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index 13bb64bf4c8f..d066f5144c3e 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -565,7 +565,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) qspi->io_base = devm_ioremap_resource(dev, res); if (IS_ERR(qspi->io_base)) { ret = PTR_ERR(qspi->io_base); - goto err; + goto err_master_put; } qspi->phys_base = res->start; @@ -574,24 +574,26 @@ static int stm32_qspi_probe(struct platform_device *pdev) qspi->mm_base = devm_ioremap_resource(dev, res); if (IS_ERR(qspi->mm_base)) { ret = PTR_ERR(qspi->mm_base); - goto err; + goto err_master_put; } qspi->mm_size = resource_size(res); if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) { ret = -EINVAL; - goto err; + goto err_master_put; } irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + if (irq < 0) { + ret = irq; + goto err_master_put; + } ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0, dev_name(dev), qspi); if (ret) { dev_err(dev, "failed to request irq\n"); - goto err; + goto err_master_put; } init_completion(&qspi->data_completion); @@ -599,26 +601,26 @@ static int stm32_qspi_probe(struct platform_device *pdev) qspi->clk = devm_clk_get(dev, NULL); if (IS_ERR(qspi->clk)) { ret = PTR_ERR(qspi->clk); - goto err; + goto err_master_put; } qspi->clk_rate = clk_get_rate(qspi->clk); if (!qspi->clk_rate) { ret = -EINVAL; - goto err; + goto err_master_put; } ret = clk_prepare_enable(qspi->clk); if (ret) { dev_err(dev, "can not enable the clock\n"); - goto err; + goto err_master_put; } rstc = devm_reset_control_get_exclusive(dev, NULL); if (IS_ERR(rstc)) { ret = PTR_ERR(rstc); if (ret == -EPROBE_DEFER) - goto err; + goto err_qspi_release; } else { reset_control_assert(rstc); udelay(2); @@ -629,7 +631,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, qspi); ret = stm32_qspi_dma_setup(qspi); if (ret) - goto err; + goto err_qspi_release; mutex_init(&qspi->lock); @@ -645,8 +647,9 @@ static int stm32_qspi_probe(struct platform_device *pdev) if (!ret) return 0; -err: +err_qspi_release: stm32_qspi_release(qspi); +err_master_put: spi_master_put(qspi->ctrl); return ret; -- 2.20.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-02-11 15:51 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-02-03 13:50 [PATCH 0/2] spi: stm32-qspi: rework probe error path patrice.chotard-qxv4g6HH51o [not found] ` <20200203135048.1299-1-patrice.chotard-qxv4g6HH51o@public.gmane.org> 2020-02-03 13:50 ` [PATCH 1/2] spi: stm32-qspi: defer probe for reset controller patrice.chotard-qxv4g6HH51o 2020-02-11 15:51 ` Applied "spi: stm32-qspi: defer probe for reset controller" to the spi tree Mark Brown 2020-02-03 13:50 ` [PATCH 2/2] spi: stm32-qspi: properly manage probe errors patrice.chotard 2020-02-11 15:51 ` Applied "spi: stm32-qspi: properly manage probe errors" to the spi tree Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).