public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Shubhrajyoti D <shubhrajyoti@ti.com>
Cc: spi-devel-general@lists.sourceforge.net,
	broonie@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: omap2-mcspi: Fix the error handling in probe
Date: Wed, 1 Aug 2012 08:07:13 -0700	[thread overview]
Message-ID: <20120801150713.GB15630@roeck-us.net> (raw)
In-Reply-To: <1343813788-19165-1-git-send-email-shubhrajyoti@ti.com>

On Wed, Aug 01, 2012 at 03:06:28PM +0530, Shubhrajyoti D wrote:
> The kfree() is taken care of by the spi core (spi_master_release() function)
> that is called once the last reference to the underlying struct device has
> been released. So the driver need not call kfree.
> 
> Also the put was missed in some of the error handling fix the same.
> There by fixing the missing device_put in some of the error paths.
> 
> Cc: Guenter Roeck <linux@roeck-us.net>

Reported-by: may be better here.

> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>

Acked-by: Guenter Roeck <linux@roeck-us.net>

I suspect that "spi_master_put(master);" may also be missing in
omap2_mcspi_remove(), but we'll need someone to confirm that.

Thanks,
Guenter

> ---
>  drivers/spi/spi-omap2-mcspi.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index 7d46b15..b5035e2 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -1203,18 +1203,16 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
>  
>  	status = spi_register_master(master);
>  	if (status < 0)
> -		goto err_spi_register;
> +		goto disable_pm;
>  
>  	return status;
>  
> -err_spi_register:
> -	spi_master_put(master);
>  disable_pm:
>  	pm_runtime_disable(&pdev->dev);
>  dma_chnl_free:
>  	kfree(mcspi->dma_channels);
>  free_master:
> -	kfree(master);
> +	spi_master_put(master);
>  	platform_set_drvdata(pdev, NULL);
>  	return status;
>  }
> -- 
> 1.7.5.4
> 
> 

  reply	other threads:[~2012-08-01 15:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01  9:36 [PATCH] spi: omap2-mcspi: Fix the error handling in probe Shubhrajyoti D
2012-08-01 15:07 ` Guenter Roeck [this message]
2012-08-02 10:07   ` Shubhrajyoti
2012-08-02 14:57     ` Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2012-08-02 11:11 Shubhrajyoti D
2012-08-04 11:06 ` Mark Brown

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=20120801150713.GB15630@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shubhrajyoti@ti.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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