From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Tang Bin <tangbin@cmss.chinamobile.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: bL_switcher: use IS_ERR_OR_NULL() to simplify code
Date: Thu, 24 Jun 2021 10:23:23 +0100 [thread overview]
Message-ID: <20210624092323.GP22278@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210624074223.11372-1-tangbin@cmss.chinamobile.com>
On Thu, Jun 24, 2021 at 03:42:23PM +0800, Tang Bin wrote:
> diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
> index 9a9aa5354..b8e8e2567 100644
> --- a/arch/arm/common/bL_switcher.c
> +++ b/arch/arm/common/bL_switcher.c
> @@ -352,11 +352,9 @@ int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
>
> t = &bL_threads[cpu];
>
> - if (IS_ERR(t->task))
> - return PTR_ERR(t->task);
> - if (!t->task)
> - return -ESRCH;
> -
> + if (IS_ERR_OR_NULL(t->task))
> + return t->task ? PTR_ERR(t->task) : -ESRCH;
> +
> spin_lock(&t->lock);
> if (t->completer) {
> spin_unlock(&t->lock);
I don't think this improves the code. The original is more readable, and
readability is what we care about rather than code compactness.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2021-06-24 9:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 7:42 [PATCH] ARM: bL_switcher: use IS_ERR_OR_NULL() to simplify code Tang Bin
2021-06-24 9:23 ` Russell King (Oracle) [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=20210624092323.GP22278@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tangbin@cmss.chinamobile.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).