linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: patrice.chotard@foss.st.com
Cc: Mark Brown <broonie@kernel.org>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	linux-spi@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, christophe.kerello@foss.st.com,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] spi: stm32-qspi: Update spi registering
Date: Sun, 16 Jan 2022 13:52:05 +0100	[thread overview]
Message-ID: <20220116125205.GA18267@wunner.de> (raw)
In-Reply-To: <20220112144424.5278-1-patrice.chotard@foss.st.com>

On Wed, Jan 12, 2022 at 03:44:24PM +0100, patrice.chotard@foss.st.com wrote:
> diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
> index 514337c86d2c..09839a3dbb26 100644
> --- a/drivers/spi/spi-stm32-qspi.c
> +++ b/drivers/spi/spi-stm32-qspi.c
> @@ -688,7 +688,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	int ret, irq;
>  
> -	ctrl = spi_alloc_master(dev, sizeof(*qspi));
> +	ctrl = devm_spi_alloc_master(dev, sizeof(*qspi));
>  	if (!ctrl)
>  		return -ENOMEM;
>  
> @@ -784,7 +784,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
>  	pm_runtime_enable(dev);
>  	pm_runtime_get_noresume(dev);
>  
> -	ret = devm_spi_register_master(dev, ctrl);
> +	ret = spi_register_master(ctrl);
>  	if (ret)
>  		goto err_pm_runtime_free;
>

Unfortunately this patch is still not correct:  It introduces a
double free in the probe error path.

You need to remove this...

err_master_put:
	spi_master_put(qspi->ctrl);

...and replace all the gotos in stm32_qspi_probe() which jump
to the err_master_put label with a return statement.

Thanks,

Lukas

  reply	other threads:[~2022-01-16 12:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 14:44 [PATCH v2] spi: stm32-qspi: Update spi registering patrice.chotard
2022-01-16 12:52 ` Lukas Wunner [this message]
2022-01-17  7:37   ` Patrice CHOTARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220116125205.GA18267@wunner.de \
    --to=lukas@wunner.de \
    --cc=alexandre.torgue@foss.st.com \
    --cc=broonie@kernel.org \
    --cc=christophe.kerello@foss.st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).