Re: [v4l-dvb-maintainer] [PATCH 3/3] V4L: cinergyT2, remove bad usage of ERESTARTSYS

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Alan Cox <alan@...>
Cc: Michael Krufky <mkrufky@...>, <video4linux-list@...>, Jiri Slaby <jirislaby@...>, <daniel@...>, <linux-kernel@...>, <holger@...>, v4l-dvb maintainer list <v4l-dvb-maintainer@...>, Andrew Morton <akpm@...>
Date: Wednesday, October 10, 2007 - 12:17 pm

Em Qua, 2007-10-10 às 11:59 -0400, Alan Cox escreveu:

LOL


Yes, this is not a severe CodingStyle violation. Still, the above code
is better than the used one.

Since, on your example, it is clear that the programmer wanted to test
if the value is less than zero. 

The code:

	if ( (err=foo()) )

should also indicate an operator mistake of using =, instead of ==.

Probably, source code analyzers like Coverity will complain about the
above.

If not violating CodingStyle, I would rather prefer to code this as:
	if ( !(err=foo() ) 
or, even better, using:
	if ( (err=foo()) != 0)

clearly indicating that it is tested if the value is not zero.

Even being a quite simple issue, I would prefer if Jiri can fix it.

-- 
Cheers,
Mauro

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 3/3] V4L: cinergyT2, remove bad usage of ERESTART..., Mauro Carvalho Chehab, (Tue Oct 9, 9:21 pm)
Re: [v4l-dvb-maintainer] [PATCH 3/3] V4L: cinergyT2, remove ..., Mauro Carvalho Chehab, (Wed Oct 10, 11:35 am)
Re: [v4l-dvb-maintainer] [PATCH 3/3] V4L: cinergyT2, remove ..., Mauro Carvalho Chehab, (Wed Oct 10, 12:17 pm)