Skip to contentSkip to conversation

common/ddr_spd.c:281:28: warning: bitwise comparison always evaluates to false

DISCUSSION Antony Pavlov 2 participants 2 messages Nov 1, 2018 – Nov 7, 2018

lore
Share & tools
lore
#0 lore raw

Hi!

I have tried to build barebox with gcc-8.2.

I see this warning:

common/ddr_spd.c:281:28:
common/ddr_spd.c: In function ‘ddr_spd_print’:
common/ddr_spd.c:281:28: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
if ((s->mod_ranks & 0x10) == 1)

                            ^~

Git blame show me this:

f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 280) printf("%-48s ", "DRAM Package ");
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 281) if ((s->mod_ranks & 0x10) == 1)
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 282) printf("Stack\n");
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 283) else
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 284) printf("Planar\n");

Please fix it.

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 11 lines · Antony Pavlov

Hi!

I have tried to build barebox with gcc-8.2.

I see this warning:

common/ddr_spd.c:281:28:
common/ddr_spd.c: In function ‘ddr_spd_print’:
common/ddr_spd.c:281:28: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
if ((s->mod_ranks & 0x10) == 1)

                            ^~

Indeed, selecting only bit 4 will never result in bit 0 being set. Is this maybe missing a ">> 4"?

- Roland

Quoted 14 lines

Git blame show me this:

f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 280) printf("%-48s ", "DRAM Package ");
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 281) if ((s->mod_ranks & 0x10) == 1)
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 282) printf("Stack\n");
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 283) else
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 284) printf("Planar\n");

Please fix it.

Signature · 2 lines
Best regards,
  Antony Pavlov
Signature · 9 lines
Roland Hieber                     | [email protected]     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox