Re: [PATCH v2] leds: Fix &&/|| confusion

From: Riku Voipio
Date: Tue Mar 03 2009 - 15:13:23 EST


On Fri, Feb 06, 2009 at 07:51:13PM +0100, Roel Kluin wrote:
> Roland Dreier wrote:
> > > - if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
> > > + if (type != EV_SND && (code != SND_BELL && code != SND_TONE))
> >
> > Actually more likely seems to be
> >
> > if (type != EV_SND || (code != SND_BELL && code != SND_TONE))
>
> Thanks for your review,

I think what I want is:

if (!(type==EV_SND && (code == SND_BELL || code == SND_TONE)))

Not that I think anyone would send SND_* without EV_SND.

From 725c752a53a83319042dcdaccf072908b29d1c40 Mon Sep 17 00:00:00 2001
From: Riku Voipio <riku.voipio@xxxxxx>
Date: Tue, 3 Mar 2009 22:06:51 +0200
Subject: [PATCH 19/19] [PATCH v2] leds: Fix &&/|| confusion

Thanks to Roel Kluin <roel.kluin@xxxxxxxxx> for noticing.

Signed-off-by: Riku Voipio <riku.voipio@xxxxxx>
---
drivers/leds/leds-pca9532.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index a46d208..dba8921 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -169,7 +169,7 @@ static int pca9532_event(struct input_dev *dev, unsigned int type,
{
struct pca9532_data *data = input_get_drvdata(dev);

- if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
+ if (!(type == EV_SND && (code == SND_BELL || code == SND_TONE)))
return -1;

/* XXX: allow different kind of beeps with psc/pwm modifications */
--
1.6.1.3

Attachment: signature.asc
Description: Digital signature