From patchwork Wed Jul 2 15:28:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 32993 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 83C9D20560 for ; Wed, 2 Jul 2014 15:29:04 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id l6sf26647193qcy.2 for ; Wed, 02 Jul 2014 08:29:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ZTqZh9Q0gLHK295DT+or6DLJQl3lX3w/3Sv6GDqdp1k=; b=PIWV1kleqSblvfL3eYnMhSoD2F6eYeo3C5JxYL8/6rFskA8I0FdeFQO52xJRNSvWnI ptqfoOlGAhJ9I4spi4pJD5h+YKw6nY775i2sfx4yjt8nqU0Q9HQezupCUrRuh9+LdDNT heHAe4DIpluVakoDHu+0gs3+VTkE9rjPuF+FzRPMKzj0qR3HvRoXqtN9N4RBDSbZwLID Gq7Lr5YuWmJwSwV3Klc/js6QUxHjI8iUY5JOj5zl3b4C4QCIWbiWEGscCdmgSoINF5Y5 NLsFS3L0Xw4WFpAN89VCGd5lHJTqGAdp7skaowkTcwqHI5Xcmw+FO04flhRZnwIXsB+z y0Pw== X-Gm-Message-State: ALoCoQnvdvrzQqfEA8srw3JQBtvWEfD1tkdAjMAucVLhEZR5Qc+GwfA/TchZMh8vBAItlAw4qnMw X-Received: by 10.58.94.197 with SMTP id de5mr29829121veb.19.1404314944366; Wed, 02 Jul 2014 08:29:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.173 with SMTP id 42ls98763qgh.27.gmail; Wed, 02 Jul 2014 08:29:04 -0700 (PDT) X-Received: by 10.52.166.10 with SMTP id zc10mr704577vdb.61.1404314944232; Wed, 02 Jul 2014 08:29:04 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id cx7si13049272vcb.57.2014.07.02.08.29.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Jul 2014 08:29:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.170 as permitted sender) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id i13so11397607veh.29 for ; Wed, 02 Jul 2014 08:29:04 -0700 (PDT) X-Received: by 10.52.244.81 with SMTP id xe17mr5402134vdc.24.1404314944148; Wed, 02 Jul 2014 08:29:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp301871vcb; Wed, 2 Jul 2014 08:29:03 -0700 (PDT) X-Received: by 10.51.16.132 with SMTP id fw4mr5504818igd.26.1404314943602; Wed, 02 Jul 2014 08:29:03 -0700 (PDT) Received: from mail-ie0-f171.google.com (mail-ie0-f171.google.com [209.85.223.171]) by mx.google.com with ESMTPS id b6si39454026ice.66.2014.07.02.08.29.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Jul 2014 08:29:03 -0700 (PDT) Received-SPF: pass (google.com: domain of lee.jones@linaro.org designates 209.85.223.171 as permitted sender) client-ip=209.85.223.171; Received: by mail-ie0-f171.google.com with SMTP id x19so9610325ier.30 for ; Wed, 02 Jul 2014 08:29:03 -0700 (PDT) X-Received: by 10.50.1.111 with SMTP id 15mr49853048igl.7.1404314943391; Wed, 02 Jul 2014 08:29:03 -0700 (PDT) Received: from localhost.localdomain (host109-148-235-194.range109-148.btcentralplus.com. [109.148.235.194]) by mx.google.com with ESMTPSA id d4sm23997781igc.5.2014.07.02.08.29.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Jul 2014 08:29:02 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: sameo@linux.intel.com, linus.walleij@linaro.org, Lee Jones Subject: [PATCH 02/12] mfd: ab8500-debugfs: Simplify invalid debugfs data checking Date: Wed, 2 Jul 2014 16:28:34 +0100 Message-Id: <1404314924-23564-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404314924-23564-1-git-send-email-lee.jones@linaro.org> References: <1404314924-23564-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Noticed during a coding review, if we reorganised the checking a little, we can rid the code of a pointless 'else'. Whilst looking for this particular code hunk I noticed another pointless 'else', which I've subsequently fixed in this patch. Cc: Linus Walleij Signed-off-by: Lee Jones Reviewed-by: Linus Walleij --- drivers/mfd/ab8500-debugfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index e23fcba..f7f271c 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -2503,14 +2503,14 @@ static ssize_t ab8500_gpadc_trig_timer_write(struct file *file, if (err) return err; - if (user_trig_timer <= 255) { - trig_timer = (u8) user_trig_timer; - } else { - dev_err(dev, "debugfs error input: " - "should be beetween 0 to 255\n"); + if (user_trig_timer & ~0xFF) { + dev_err(dev, + "debugfs error input: should be beetween 0 to 255\n"); return -EINVAL; } + trig_timer = (u8) user_trig_timer; + return count; } @@ -2764,8 +2764,8 @@ static ssize_t show_irq(struct device *dev, irq_index = name - irq_first; if (irq_index >= num_irqs) return -EINVAL; - else - return sprintf(buf, "%u\n", irq_count[irq_index]); + + return sprintf(buf, "%u\n", irq_count[irq_index]); } static ssize_t ab8500_subscribe_write(struct file *file,