Thread (83 messages) flat view 83 messages, 6 authors, 2018-03-27

Re: [PATCH 01/21] powerpc: Remove warning on array size when empty

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-03-01 02:56:03
Also in: lkml
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

Mathieu Malaterre [off-list ref] writes:
When neither CONFIG_ALTIVEC, nor CONFIG_VSX or CONFIG_PPC64 is defined, t=
he
array feature_properties is defined as an empty array, which in turn
triggers the following warning (treated as error on W=3D1):

  CC      arch/powerpc/kernel/prom.o
arch/powerpc/kernel/prom.c: In function =E2=80=98check_cpu_feature_proper=
ties=E2=80=99:
arch/powerpc/kernel/prom.c:298:16: error: comparison of unsigned expressi=
on < 0 is always false [-Werror=3Dtype-limits]
  for (i =3D 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) {
                ^
cc1: all warnings being treated as errors
Ugh, that's annoying.

This seems to work?
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 4dffef947b8a..5215119e249c 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -291,11 +291,11 @@ static inline void identical_pvr_fixup(unsigned long =
node)
=20
 static void __init check_cpu_feature_properties(unsigned long node)
 {
-	unsigned long i;
 	struct feature_property *fp =3D feature_properties;
 	const __be32 *prop;
+	int i;
=20
-	for (i =3D 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) {
+	for (i =3D 0; i < (int)ARRAY_SIZE(feature_properties); ++i, ++fp) {
 		prop =3D of_get_flat_dt_prop(node, fp->name, NULL);
 		if (prop && be32_to_cpup(prop) >=3D fp->min_value) {
 			cur_cpu_spec->cpu_features |=3D fp->cpu_feature;


cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help