linux-4.5-rc4/arch/powerpc/boot/treeboot-akebono.c:90: possible bad test ?

3 messages, 2 authors, 2016-02-17 · open the first message on its own page

linux-4.5-rc4/arch/powerpc/boot/treeboot-akebono.c:90: possible bad test ?

From: David Binderman <hidden>
Date: 2016-02-16 08:20:48

hello there=2C=0A=
=0A=
[linux-4.5-rc4/arch/powerpc/boot/treeboot-akebono.c:90]: (style) A pointer =
can not be negative so it is either pointless or an error to check if it is=
 not.=0A=
=0A=
Source code is=0A=
=0A=
=A0=A0=A0 emac =3D finddevice("/plb/opb/ethernet")=3B=0A=
=A0=A0=A0 if (emac> 0) {=0A=
=0A=
but=0A=
=0A=
=A0=A0=A0 void *emac=3B=0A=
=0A=
Suggest new code=0A=
=0A=
=A0=A0=A0 emac =3D finddevice("/plb/opb/ethernet")=3B=0A=
=A0=A0=A0 if (emac !=3D 0) {=0A=
=0A=
=0A=
Regards=0A=
=0A=
David Binderman=0A=
 		 	   		  =

Re: linux-4.5-rc4/arch/powerpc/boot/treeboot-akebono.c:90: possible bad test ?

From: Daniel Axtens <hidden>
Date: 2016-02-16 22:40:03

Hi David,
[linux-4.5-rc4/arch/powerpc/boot/treeboot-akebono.c:90]: (style) A pointe=
r can not be negative so it is either pointless or an error to check if it =
is not.
Source code is

=C2=A0=C2=A0=C2=A0 emac =3D finddevice("/plb/opb/ethernet");
=C2=A0=C2=A0=C2=A0 if (emac> 0) {

but

=C2=A0=C2=A0=C2=A0 void *emac;

Suggest new code

=C2=A0=C2=A0=C2=A0 emac =3D finddevice("/plb/opb/ethernet");
=C2=A0=C2=A0=C2=A0 if (emac !=3D 0) {
That looks like a good suggestion: maybe make the test 'if (!emac)'
rather than explicitly comparing with zero.

Are you comfortable sending a patch to that effect? A patch generated by
git format-patch and sent with git send-email are usually the easiest.

If you have any difficulties, feel free to ping me off-list and I can
walk you through the process.

Regards,
Daniel

RE: linux-4.5-rc4/arch/powerpc/boot/treeboot-akebono.c:90: possible bad test ?

From: David Binderman <hidden>
Date: 2016-02-17 07:39:44

Hello there Daniel=2C=0A=
=0A=
----------------------------------------=0A=
That looks like a good suggestion: maybe make the test 'if (!emac)'=0A=
rather than explicitly comparing with zero.=0A=
=0A=
Righto.=0A=
=0A=
Are you comfortable sending a patch to that effect?=0A=
=0A=
Sorry=2C no. =0A=
=0A=
My email provider can't implement the somewhat strict whitespace=0A=
rules of kernel patches.=0A=
=0A=
Nothing stopping any keen person implementing that patch=2C however =3B->=
=0A=
=0A=
I checked the rest of the treeboot-akebono.c source code file with=0A=
the static analyser and found nothing wrong. No warnings from=0A=
gcc -Wextra=2C either=2C so after the patch=2C it looks ok to me.=0A=
=0A=
=0A=
Regards=0A=
=0A=
David Binderman=0A=
=0A=
 		 	   		  =
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help