Re: [PATCH 32/46] [media] e4000: simplify boolean tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Which is static analyzer you are referring to fix these?

Using true/false for boolean datatype sounds OK, but personally I dislike use of negation operator. For my eyes (foo = 0) / (foo == false) is better and I have changed all the time negate operators to equal operators from my drivers.

regards
Antti

On 09/03/2014 11:33 PM, Mauro Carvalho Chehab wrote:
Instead of using if (foo == false), just use
if (!foo).

That allows a faster mental parsing when analyzing the
code.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@xxxxxxxxxxx>

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 90d93348f20c..cd9cf643f602 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -400,7 +400,7 @@ static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
  	struct e4000 *s = container_of(ctrl->handler, struct e4000, hdl);
  	int ret;

-	if (s->active == false)
+	if (!s->active)
  		return 0;

  	switch (ctrl->id) {
@@ -423,7 +423,7 @@ static int e4000_s_ctrl(struct v4l2_ctrl *ctrl)
  	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
  	int ret;

-	if (s->active == false)
+	if (!s->active)
  		return 0;

  	switch (ctrl->id) {


--
http://palosaari.fi/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux