From patchwork Sun Jul 26 21:48:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 500176 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-lb0-x23b.google.com (mail-lb0-x23b.google.com [IPv6:2a00:1450:4010:c04::23b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1ED8B1404A8 for ; Mon, 27 Jul 2015 07:48:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b=Z7jsfkt1; dkim-atps=neutral Received: by lbbvz8 with SMTP id vz8sf29777829lbb.0 for ; Sun, 26 Jul 2015 14:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:content-type:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe; bh=oyesP7DB/i8XJr/cBIuoo9G8s/fvGGsINvGZnx/XVDc=; b=Z7jsfkt1IxKphAvWDA6jJUhIQZI0zS819E7WZU13UV++VjLUdh+rXq1UWLmZ7JPJ2+ IVY/vmMy1VovQsFRa3yzcO26Yvb14qmJ0t1OsIbXp/DuKswX0cxAX/4rLJOpmszRqvHA l6i7m2lX2KbGwYXMeeHG+royICakepQxReGFIxKhndJb5Gb0Jj9mAdnp4FfV0Eukl5bK 1Eg8mQ82301qYZ4Y7nvlXc0fgkhmVJWCC3kI/g3d6VTRrdbUNnd/Akm2OQ0m7TIixG5l GqwQf84KJD0BaWtxE1FvszBXPGYAsbLo5/yUCN2QD+/EFjLPS/uBPduo9w6/vSr11+Q/ e9/w== X-Received: by 10.152.121.34 with SMTP id lh2mr347166lab.26.1437947328714; Sun, 26 Jul 2015 14:48:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.152.28.100 with SMTP id a4ls598146lah.52.gmail; Sun, 26 Jul 2015 14:48:48 -0700 (PDT) X-Received: by 10.112.253.135 with SMTP id aa7mr10746864lbd.11.1437947328186; Sun, 26 Jul 2015 14:48:48 -0700 (PDT) Received: from mail.mleia.com (li271-223.members.linode.com. [178.79.152.223]) by gmr-mx.google.com with ESMTPS id q10si280080wiz.0.2015.07.26.14.48.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jul 2015 14:48:48 -0700 (PDT) Received-SPF: neutral (google.com: 178.79.152.223 is neither permitted nor denied by best guess record for domain of vz@mleia.com) client-ip=178.79.152.223; Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id 40DA2101217; Sun, 26 Jul 2015 22:54:00 +0100 (BST) Received: from localhost.localdomain (a91-152-106-128.elisa-laajakaista.fi [91.152.106.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mleia.com (Postfix) with ESMTPSA id F2CA3101215; Sun, 26 Jul 2015 22:53:59 +0100 (BST) From: Vladimir Zapolskiy To: Alessandro Zummo , Alexandre Belloni Cc: rtc-linux@googlegroups.com, Greg Kroah-Hartman Subject: [rtc-linux] [PATCH 10/11] rtc: stk17ta8: clean up stk17ta8_nvram_read()/stk17ta8_nvram_write() Date: Mon, 27 Jul 2015 00:48:35 +0300 Message-Id: <1437947316-5652-11-git-send-email-vz@mleia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437947316-5652-1-git-send-email-vz@mleia.com> References: <1437947316-5652-1-git-send-email-vz@mleia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20150726_225400_286438_803CBD62 X-CRM114-Status: GOOD ( 16.57 ) X-Original-Sender: vz@mleia.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 178.79.152.223 is neither permitted nor denied by best guess record for domain of vz@mleia.com) smtp.mail=vz@mleia.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: rtc-linux@googlegroups.com X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , The change removes redundant sysfs binary file boundary checks, since this task is already done on caller side in fs/sysfs/file.c Signed-off-by: Vladimir Zapolskiy --- drivers/rtc/rtc-stk17ta8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 0e93b71..ba6a83b 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c @@ -254,7 +254,7 @@ static ssize_t stk17ta8_nvram_read(struct file *filp, struct kobject *kobj, void __iomem *ioaddr = pdata->ioaddr; ssize_t count; - for (count = 0; size > 0 && pos < RTC_OFFSET; count++, size--) + for (count = 0; count < size; count++) *buf++ = readb(ioaddr + pos++); return count; } @@ -269,7 +269,7 @@ static ssize_t stk17ta8_nvram_write(struct file *filp, struct kobject *kobj, void __iomem *ioaddr = pdata->ioaddr; ssize_t count; - for (count = 0; size > 0 && pos < RTC_OFFSET; count++, size--) + for (count = 0; count < size; count++) writeb(*buf++, ioaddr + pos++); return count; }