From: Dan Carpenter <dan.carpenter@oracle.com>
To: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
driverdev-devel@linuxdriverproject.org,
devel@driverdev.osuosl.org, Ofir Drang <ofir.drang@arm.com>
Subject: Re: [PATCH 5/7] staging: ccree: add clock management support
Date: Thu, 22 Jun 2017 11:58:15 +0300 [thread overview]
Message-ID: <20170622085815.xaw6dn56t2yjrdm4@mwanda> (raw)
In-Reply-To: <1498115276-1601-6-git-send-email-gilad@benyossef.com>
On Thu, Jun 22, 2017 at 10:07:51AM +0300, Gilad Ben-Yossef wrote:
> +int cc_clk_on(struct ssi_drvdata *drvdata)
> +{
> + int rc = 0;
> + struct clk *clk = drvdata->clk;
> +
> + if (IS_ERR(clk))
> + /* No all devices have a clock associated with CCREE */
> + goto out;
Ugh... I hate this. The "goto out;" here is a waste of time
do-nothing-goto that returns diretly. It's equivalent to "return 0;".
Is that intended? Even with the comment, it's not clear...
People think do nothing gotos are a great idea but from reviewing tons
and tons of real life errors, I can assure you that in real life (as
opposed to theory) they don't prevent any future bugs and only introduce
"forgot to set the error code" bugs.
The indenting is messed up and multi-line indents get curly braces.
> +
> + rc = clk_prepare_enable(clk);
> + if (rc) {
> + SSI_LOG_ERR("error enabling clock\n");
> + clk_disable_unprepare(clk);
Don't unprepare something that hasn't been prepared.
> + }
> +
> +out:
> + return rc;
> +}
int cc_clk_on(struct ssi_drvdata *drvdata)
{
struct clk *clk = drvdata->clk;
int rc;
if (IS_ERR(clk)) {
/* Not all devices have a clock associated with CCREE */
return 0;
}
rc = clk_prepare_enable(clk);
if (rc)
return rc;
return 0;
}
regards,
dan carpenter
next prev parent reply other threads:[~2017-06-22 8:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 7:07 [PATCH 0/7] staging: ccree: bug fixes and TODO items for 4.13 Gilad Ben-Yossef
2017-06-22 7:07 ` [PATCH 1/7] staging: ccree: fix hash import/export Gilad Ben-Yossef
2017-06-22 7:07 ` [PATCH 2/7] staging: ccree: register setkey for none hash macs Gilad Ben-Yossef
2017-06-22 7:07 ` [PATCH 3/7] staging: ccree: add support for older HW revisions Gilad Ben-Yossef
2017-06-23 8:04 ` kbuild test robot
2017-06-24 3:35 ` kbuild test robot
2017-06-22 7:07 ` [PATCH 4/7] staging: ccree: remove unused function Gilad Ben-Yossef
2017-06-22 7:07 ` [PATCH 5/7] staging: ccree: add clock management support Gilad Ben-Yossef
2017-06-22 8:58 ` Dan Carpenter [this message]
2017-06-22 13:29 ` Gilad Ben-Yossef
2017-06-22 7:07 ` [PATCH 6/7] staging: ccree: add DT bus coherency detection Gilad Ben-Yossef
2017-06-22 9:04 ` Dan Carpenter
2017-06-22 13:34 ` Gilad Ben-Yossef
2017-06-22 7:07 ` [PATCH 7/7] staging: ccree: use signal safe completion wait Gilad Ben-Yossef
2017-06-22 7:14 ` [PATCH 0/7] staging: ccree: bug fixes and TODO items for 4.13 Gilad Ben-Yossef
2017-06-22 8:28 ` Dan Carpenter
2017-06-22 8:37 ` Gilad Ben-Yossef
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=20170622085815.xaw6dn56t2yjrdm4@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gilad@benyossef.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ofir.drang@arm.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
all inboxes | Powered by JetHome®