From: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
To: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Jarkko Nikula
<jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] spi: dw: Don't call kfree for memory allocated by devm_kzalloc
Date: Tue, 25 Mar 2014 06:16:42 +0200 [thread overview]
Message-ID: <20140325041642.GB31764@tarshish> (raw)
In-Reply-To: <1395710723.29281.3.camel@phoenix>
Hi Axel Lin,
On Tue, Mar 25, 2014 at 09:25:23AM +0800, Axel Lin wrote:
> With devm_kzalloc, the memory is automatically freed when spi_device detach from
> the bus.
>
> Fixes: commit 04f421e7b0b1 (spi: dw: use managed resources)
The devm_kzalloc for this struct was introduced in 43f627ac9de42 (spi: dw: fix
memory leak on error path). Other than that:
Acked-by: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
Thanks,
baruch
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
> ---
> drivers/spi/spi-dw.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
> index 8b7e4a3..712ac562 100644
> --- a/drivers/spi/spi-dw.c
> +++ b/drivers/spi/spi-dw.c
> @@ -664,12 +664,6 @@ static int dw_spi_setup(struct spi_device *spi)
> return 0;
> }
>
> -static void dw_spi_cleanup(struct spi_device *spi)
> -{
> - struct chip_data *chip = spi_get_ctldata(spi);
> - kfree(chip);
> -}
> -
> static int init_queue(struct dw_spi *dws)
> {
> INIT_LIST_HEAD(&dws->queue);
> @@ -799,7 +793,6 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
> master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
> master->bus_num = dws->bus_num;
> master->num_chipselect = dws->num_cs;
> - master->cleanup = dw_spi_cleanup;
> master->setup = dw_spi_setup;
> master->transfer = dw_spi_transfer;
> master->max_speed_hz = dws->max_freq;
> --
> 1.8.3.2
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org - tel: +972.2.679.5364, http://www.tkos.co.il -
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2014-03-25 4:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 1:25 [PATCH] spi: dw: Don't call kfree for memory allocated by devm_kzalloc Axel Lin
2014-03-25 4:16 ` Baruch Siach [this message]
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=20140325041642.GB31764@tarshish \
--to=baruch-nswtu9s1w3p6gbpvegmw2w@public.gmane.org \
--cc=axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).