From: Dan Carpenter <dan.carpenter@oracle.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Paul Burton <paul.burton@mips.com>,
Colin King <colin.king@canonical.com>,
Michael Turquette <mturquette@baylibre.com>,
linux-mips@linux-mips.org, linux-clk@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: boston: fix memory leak of 'onecell' on error return paths
Date: Wed, 16 May 2018 14:42:54 +0300 [thread overview]
Message-ID: <20180516114254.wffddft537t45yfg@mwanda> (raw)
In-Reply-To: <152640892003.34267.13202118557714072290@swboyd.mtv.corp.google.com>
On Tue, May 15, 2018 at 11:28:40AM -0700, Stephen Boyd wrote:
> Quoting Dan Carpenter (2018-05-09 23:59:51)
> > It would be nice to make things static check clean. One idea would be
> > that the static checker could ignore resource leaks in __init functions.
> >
>
> Typically if the stuff is so important that it doesn't work without it
> then we throw in a panic() or a BUG() call to indicate that all hope is
> lost. Otherwise, I'm not sure what's wrong with adding in proper error
> paths for clean recovery.
In clk_boston_setup() then we'd have to put a ton of BUG()s in there to
silence all the warnings. Right now the static checkers only care about
kmalloc() but in a year or two they'll be clever enough to care about
everything leaked in this function. I don't think adding BUG() calls
is a good idea.
Plus, I have a private static checker warning for that. When the BTRFS
filesystem was merged 10 years ago it used to call BUG() all the time if
allocations failed so I made a static checker warning to spot that
anti-pattern...
regards,
dan carpenter
prev parent reply other threads:[~2018-05-16 11:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 13:40 [PATCH] clk: boston: fix memory leak of 'onecell' on error return paths Colin King
2018-05-09 14:01 ` Dan Carpenter
2018-05-09 16:33 ` Paul Burton
2018-05-09 16:44 ` Colin Ian King
2018-05-10 6:59 ` Dan Carpenter
2018-05-15 18:28 ` Stephen Boyd
2018-05-16 11:42 ` Dan Carpenter [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=20180516114254.wffddft537t45yfg@mwanda \
--to=dan.carpenter@oracle.com \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mturquette@baylibre.com \
--cc=paul.burton@mips.com \
--cc=sboyd@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