All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Wolfgang Denk <wd@denx.de>, u-boot@lists.denx.de
Subject: Re: [PATCH 1/1] powerpc: fix fdt_fixup_liodn_tbl_fman()
Date: Thu, 13 Oct 2022 18:12:36 +0200	[thread overview]
Message-ID: <20221013181236.0c5e94d8@thinkpad> (raw)
In-Reply-To: <20221012171311.42881-1-heinrich.schuchardt@canonical.com>

On Wed, 12 Oct 2022 19:13:11 +0200
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> wrote:

> Builiding with GCC 12.2 fails:
> 
>     arch/powerpc/cpu/mpc85xx/liodn.c: In function 'fdt_fixup_liodn_tbl_fman':
>     arch/powerpc/cpu/mpc85xx/liodn.c:340:35: error: the comparison will
>     always evaluate as 'false' for the address of 'compat'
>     will never be NULL [-Werror=address]
>       340 |                 if (tbl[i].compat == NULL)
>           |
> 
> Remove the superfluous check.
> 
> Fixes: 97a8d010e029 ("net/fman: Support both new and legacy FMan Compatibles")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/powerpc/cpu/mpc85xx/liodn.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/powerpc/cpu/mpc85xx/liodn.c b/arch/powerpc/cpu/mpc85xx/liodn.c
> index a084002494..2d55916841 100644
> --- a/arch/powerpc/cpu/mpc85xx/liodn.c
> +++ b/arch/powerpc/cpu/mpc85xx/liodn.c
> @@ -337,9 +337,6 @@ static void fdt_fixup_liodn_tbl_fman(void *blob,
>  	for (i = 0; i < sz; i++) {
>  		int off;
>  
> -		if (tbl[i].compat == NULL)
> -			continue;
> -
>  		/* Try the new compatible first.
>  		 * If the node is missing, try the old.
>  		 */

This is the wrong fix, IMO. Instead we should do something like

diff --git a/arch/powerpc/cpu/mpc85xx/liodn.c b/arch/powerpc/cpu/mpc85xx/liodn.c
index a084002494..41b7d53ec3 100644
--- a/arch/powerpc/cpu/mpc85xx/liodn.c
+++ b/arch/powerpc/cpu/mpc85xx/liodn.c
@@ -337,7 +337,7 @@ static void fdt_fixup_liodn_tbl_fman(void *blob,
 	for (i = 0; i < sz; i++) {
 		int off;
 
-		if (tbl[i].compat == NULL)
+		if (tbl[i].compat[0] == NULL)
 			continue;
 
 		/* Try the new compatible first.
@@ -345,7 +345,7 @@ static void fdt_fixup_liodn_tbl_fman(void *blob,
 		  */
 		off = fdt_node_offset_by_compat_reg(blob,
 				tbl[i].compat[0], tbl[i].compat_offset);
-		if (off < 0)
+		if (off < 0 && tbl[i].compat[1] != NULL)
 			off = fdt_node_offset_by_compat_reg(blob,
 					tbl[i].compat[1], tbl[i].compat_offset);

  reply	other threads:[~2022-10-13 16:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 17:13 [PATCH 1/1] powerpc: fix fdt_fixup_liodn_tbl_fman() Heinrich Schuchardt
2022-10-13 16:12 ` Marek Behún [this message]
2022-10-13 16:47   ` Heinrich Schuchardt
2022-10-13 20:07     ` Marek Behún
2022-12-07 14:11 ` Tom Rini

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=20221013181236.0c5e94d8@thinkpad \
    --to=kabel@kernel.org \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.de \
    /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.