linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Varka Bhadram <varkabhadram@gmail.com>
Cc: Yao Yuan <yao.yuan@freescale.com>,
	"wsa@the-dreams.de" <wsa@the-dreams.de>,
	"marex@denx.de" <marex@denx.de>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v5 1/2] i2c: add DMA support for freescale i2c driver
Date: Wed, 23 Jul 2014 14:15:02 +0200	[thread overview]
Message-ID: <20140723141502.2d726afe@ipc1.ka-ro> (raw)
In-Reply-To: <53CF9933.8030908@gmail.com>

Hi,

Varka Bhadram wrote:
> On 07/23/2014 04:41 PM, Yao Yuan wrote:
> > Hi,
> >
> > Thanks for your review.
> >
> > Lothar Waßmann wrote:
> >> Yuan Yao wrote:
> >>> Add dma support for i2c. This function depend on DMA driver.
> >>> You can turn on it by write both the dmas and dma-name properties in dts node.
> >>>
> >>> Signed-off-by: Yuan Yao <yao.yuan@freescale.com>
> >>> ---
> >>>   drivers/i2c/busses/i2c-imx.c | 377
> > [...]
> >>> +
> >>> +fail_rx:
> >>> +	dma_release_channel(dma->chan_rx);
> >>> +fail_tx:
> >>> +	dma_release_channel(dma->chan_tx);
> >>> +fail_al:
> >>> +	devm_kfree(dev, dma);
> >>>
> >> No need for this one (that's the whole point of using devm_kzalloc())!
> >>
> > When DMA request failed, I2C will switch to PIO mode. So if the failed reason is just like DMA channel request failed. At this time the DMA should free by devm_kfree(). Is it?
> 
> If probe failed the memory will be freed automatically because
> we are using devm_kzalloc()...
> 
> If we use devm_kzalloc() ,no need to free manually on fail...
> 
Yes, but as Yuan Yao stated, the driver will still work
without DMA but carry around the unecessary allocated imx_i2c_dma
struct.
The devm_kfree() is not in the failure path of the driver's probe()
function, but in the function that tries to initialize the optional DMA
support.


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

  reply	other threads:[~2014-07-23 12:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23  8:24 [PATCH v5 0/2] i2c: add DMA support for freescale i2c driver Yuan Yao
2014-07-23  8:24 ` [PATCH v5 1/2] " Yuan Yao
2014-07-23  9:48   ` Lothar Waßmann
2014-07-23 11:11     ` Yao Yuan
2014-07-23 11:14       ` Varka Bhadram
2014-07-23 12:15         ` Lothar Waßmann [this message]
2014-07-23 16:52           ` Marek Vasut
2014-07-31  6:16             ` Yao Yuan
2014-07-23 12:11       ` Lothar Waßmann
2014-07-23  8:24 ` [PATCH v5 2/2] Documentation:add " Yuan Yao
2014-07-23 12:28 ` [PATCH v5 0/2] i2c: add " Marek Vasut
2014-07-24  3:36   ` Yao Yuan
2014-07-24  4:16     ` Marek Vasut

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=20140723141502.2d726afe@ipc1.ka-ro \
    --to=lw@karo-electronics.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mark.rutland@arm.com \
    --cc=shawn.guo@linaro.org \
    --cc=varkabhadram@gmail.com \
    --cc=wsa@the-dreams.de \
    --cc=yao.yuan@freescale.com \
    /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).