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/smp_twd: Cleanup the unnecessary cast
Date: Wed, 11 Aug 2021 14:31:22 +0100 [thread overview]
Message-ID: <20210811133121.GV22278@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210811131512.940-1-tangbin@cmss.chinamobile.com>
On Wed, Aug 11, 2021 at 09:15:12PM +0800, Tang Bin wrote:
> It's not necessary to specify 'int' castingfor 'PTR_ERR(twd_clk)'.
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> arch/arm/kernel/smp_twd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> index 9a14f721a..423e9079d 100644
> --- a/arch/arm/kernel/smp_twd.c
> +++ b/arch/arm/kernel/smp_twd.c
> @@ -199,7 +199,7 @@ static void twd_get_clock(struct device_node *np)
> twd_clk = clk_get_sys("smp_twd", NULL);
>
> if (IS_ERR(twd_clk)) {
> - pr_err("smp_twd: clock not found %d\n", (int) PTR_ERR(twd_clk));
> + pr_err("smp_twd: clock not found %d\n", PTR_ERR(twd_clk));
Sorry, NAK.
This change _will_ produce a compiler warning. "%d" expects an argument
of type "int", but PTR_ERR() returns a type of "long". Sorry, but the
cast is entirely necessary.
A better solution today would be to get rid of the PTR_ERR() entirely
and use %pe, which will get us a textual description of the error when
the appropriate kernel configuration option is enabled.
Thanks.
--
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
WARNING: multiple messages have this Message-ID (diff)
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/smp_twd: Cleanup the unnecessary cast
Date: Wed, 11 Aug 2021 14:31:22 +0100 [thread overview]
Message-ID: <20210811133121.GV22278@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210811131512.940-1-tangbin@cmss.chinamobile.com>
On Wed, Aug 11, 2021 at 09:15:12PM +0800, Tang Bin wrote:
> It's not necessary to specify 'int' castingfor 'PTR_ERR(twd_clk)'.
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> arch/arm/kernel/smp_twd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> index 9a14f721a..423e9079d 100644
> --- a/arch/arm/kernel/smp_twd.c
> +++ b/arch/arm/kernel/smp_twd.c
> @@ -199,7 +199,7 @@ static void twd_get_clock(struct device_node *np)
> twd_clk = clk_get_sys("smp_twd", NULL);
>
> if (IS_ERR(twd_clk)) {
> - pr_err("smp_twd: clock not found %d\n", (int) PTR_ERR(twd_clk));
> + pr_err("smp_twd: clock not found %d\n", PTR_ERR(twd_clk));
Sorry, NAK.
This change _will_ produce a compiler warning. "%d" expects an argument
of type "int", but PTR_ERR() returns a type of "long". Sorry, but the
cast is entirely necessary.
A better solution today would be to get rid of the PTR_ERR() entirely
and use %pe, which will get us a textual description of the error when
the appropriate kernel configuration option is enabled.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2021-08-11 13:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 13:15 [PATCH] ARM/smp_twd: Cleanup the unnecessary cast Tang Bin
2021-08-11 13:15 ` Tang Bin
2021-08-11 13:31 ` Russell King (Oracle) [this message]
2021-08-11 13:31 ` Russell King (Oracle)
2021-08-11 13:47 ` tangbin
2021-08-11 13:47 ` tangbin
2021-08-11 20:08 ` kernel test robot
2021-08-11 20:08 ` kernel test robot
2021-08-11 20:08 ` kernel test robot
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=20210811133121.GV22278@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.