Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753146AbdGHT0X (ORCPT ); Sat, 8 Jul 2017 15:26:23 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35511 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbdGHT0V (ORCPT ); Sat, 8 Jul 2017 15:26:21 -0400 From: Christos Gkekas To: Joe Perches , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christos Gkekas Subject: [PATCH RESEND] HID: wacom: Remove comparison of u8 mode with zero and simplify. Date: Sat, 8 Jul 2017 20:25:48 +0100 Message-Id: <1499541948-3392-1-git-send-email-chris.gekas@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 837 Lines: 27 Variable mode in method wacom_show_remote_mode() is defined as u8, thus statement (mode >= 0) is always true and should be removed, simplifying the logic. Signed-off-by: Christos Gkekas --- drivers/hid/wacom_sys.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 838c1eb..ae2408d 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1671,10 +1671,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj, u8 mode; mode = wacom->led.groups[index].select; - if (mode >= 0 && mode < 3) - return snprintf(buf, PAGE_SIZE, "%d\n", mode); - else - return snprintf(buf, PAGE_SIZE, "%d\n", -1); + return sprintf(buf, "%d\n", mode < 3 ? mode : -1); } #define DEVICE_EKR_ATTR_GROUP(SET_ID) \ -- 2.7.4