From patchwork Sat Aug 6 22:18:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 1042172 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p76MSrgc021636 for ; Sat, 6 Aug 2011 22:28:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756876Ab1HFW2K (ORCPT ); Sat, 6 Aug 2011 18:28:10 -0400 Received: from sinikuusama.dnainternet.net ([83.102.40.134]:57799 "EHLO sinikuusama.dnainternet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756808Ab1HFW2E (ORCPT ); Sat, 6 Aug 2011 18:28:04 -0400 Received: from localhost (localhost [127.0.0.1]) by sinikuusama.dnainternet.net (Postfix) with ESMTP id 81E634010E; Sun, 7 Aug 2011 01:19:10 +0300 (EEST) X-Virus-Scanned: DNA Postiturva at dnainternet.net X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-9999 required=6 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from sinikuusama.dnainternet.net ([83.102.40.134]) by localhost (sinikuusama.dnainternet.net [127.0.0.1]) (DNA Postiturva, port 10041) with ESMTP id WjdZ6K5+S-kc; Sun, 7 Aug 2011 01:19:10 +0300 (EEST) Received: from oliivipuu.dnainternet.net (oliivipuu.dnainternet.net [83.102.40.215]) by sinikuusama.dnainternet.net (Postfix) with ESMTP id 511103F8F7; Sun, 7 Aug 2011 01:19:10 +0300 (EEST) Received: from mail.onse.fi (host-109-204-162-131.tp-fne.tampereenpuhelin.net [109.204.162.131]) by oliivipuu.dnainternet.net (Postfix) with ESMTP id 2C10F2BAD3; Sun, 7 Aug 2011 01:19:09 +0300 (EEST) Received: by mail.onse.fi (Postfix, from userid 501) id C3213200FCF; Sun, 7 Aug 2011 01:19:05 +0300 (EEST) From: Anssi Hannula To: dmitry.torokhov@gmail.com Cc: linux-media@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] [media] ati_remote: fix check for a weird byte Date: Sun, 7 Aug 2011 01:18:10 +0300 Message-Id: <1312669093-23771-5-git-send-email-anssi.hannula@iki.fi> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1312669093-23771-1-git-send-email-anssi.hannula@iki.fi> References: <4E3DB2C2.7040104@iki.fi> <1312669093-23771-1-git-send-email-anssi.hannula@iki.fi> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 06 Aug 2011 22:28:54 +0000 (UTC) The ati_remote_dump() function tries to not print "Weird byte" warning for 1-byte responses that contain 0xff or 0x00, but it doesn't work properly as it simply falls back to the "Weird data" warning in the else clause. Fix that by adding an inner if clause. Signed-off-by: Anssi Hannula --- drivers/media/rc/ati_remote.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 842dee4..74cc6b1 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -273,9 +273,10 @@ static struct usb_driver ati_remote_driver = { static void ati_remote_dump(struct device *dev, unsigned char *data, unsigned int len) { - if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00)) - dev_warn(dev, "Weird byte 0x%02x\n", data[0]); - else if (len == 4) + if (len == 1) { + if (data[0] != (unsigned char)0xff && data[0] != 0x00) + dev_warn(dev, "Weird byte 0x%02x\n", data[0]); + } else if (len == 4) dev_warn(dev, "Weird key %02x %02x %02x %02x\n", data[0], data[1], data[2], data[3]); else