From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Libo Chen <clbchenlibo.chen@huawei.com>
Cc: vinod.koul@intel.com, grant.likely@linaro.org,
rob.herring@calxeda.com,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org,
Libo Chen <libo.chen@huawei.com>,
agust@denx.de, phdm@macqel.be, Li Zefan <lizefan@huawei.com>
Subject: Re: [PATCH] bestcomm: no need to free when kzalloc fail
Date: Wed, 22 May 2013 16:06:28 +1000 [thread overview]
Message-ID: <1369202788.3870.3.camel@pasglop> (raw)
In-Reply-To: <519C4E4D.1060101@huawei.com>
On Wed, 2013-05-22 at 12:49 +0800, Libo Chen wrote:
> ping...
This is pointless. We routinely avoid adding such crap by having
the various free(...) routines cope with NULL. You just need to make
sure you are indeed NULL in the error case.
Ben.
> On 2013/5/5 16:38, chenlibo.3@gmail.com wrote:
> > From: Libo Chen <libo.chen@huawei.com>
> >
> > There is no need to free bcom_eng if kzalloc fail
> >
> > Signed-off-by: Libo Chen <libo.chen@huawei.com>
> > ---
> > drivers/dma/bestcomm/bestcomm.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
> > index a8c2e29..300ee2d 100644
> > --- a/drivers/dma/bestcomm/bestcomm.c
> > +++ b/drivers/dma/bestcomm/bestcomm.c
> > @@ -400,7 +400,7 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
> > printk(KERN_ERR DRIVER_NAME ": "
> > "Can't allocate state structure\n");
> > rv = -ENOMEM;
> > - goto error_sramclean;
> > + goto error_kzalloc;
> > }
> >
> > /* Save the node */
> > @@ -449,6 +449,7 @@ error_release:
> > release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
> > error_sramclean:
> > kfree(bcom_eng);
> > +error_kzalloc:
> > bcom_sram_cleanup();
> > error_ofput:
> > of_node_put(op->dev.of_node);
> >
>
next prev parent reply other threads:[~2013-05-22 6:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-05 8:38 [PATCH] bestcomm: no need to free when kzalloc fail chenlibo.3
2013-05-22 4:49 ` Libo Chen
2013-05-22 4:58 ` Li Zefan
2013-05-22 6:03 ` Libo Chen
2013-05-22 6:06 ` Benjamin Herrenschmidt [this message]
2013-05-22 6:35 ` Libo Chen
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=1369202788.3870.3.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=agust@denx.de \
--cc=akpm@linux-foundation.org \
--cc=clbchenlibo.chen@huawei.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@linaro.org \
--cc=libo.chen@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=phdm@macqel.be \
--cc=rob.herring@calxeda.com \
--cc=vinod.koul@intel.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