From patchwork Sat Jun 5 09:10:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wan ZongShun X-Patchwork-Id: 54743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (unknown [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CBD90B7D2E for ; Sat, 5 Jun 2010 19:11:57 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1OKpOk-0007Ja-NA; Sat, 05 Jun 2010 09:10:34 +0000 Received: from mail-pv0-f177.google.com ([74.125.83.177]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1OKpOY-00073a-Om; Sat, 05 Jun 2010 09:10:23 +0000 Received: by pvg11 with SMTP id 11so434207pvg.36 for ; Sat, 05 Jun 2010 02:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=UPBINtSTz1xBkG2PJ3JcPRMd53RJr4n/ar3cP/so37w=; b=ryVh7abFt8WpGlxQ53XThwKd3EA7viyOVPlPIR+FpjMQc2PD+WRkfvBzcQh4GK18np wQ25XSgqCDVt06bzhOfM1T86gjd60XkcKinfrW6NeKOC8t4uMz7OwEh0HZS/8xKEEj+1 lGXSFckU2fdJHplCN4eXpWxf5T5yObU/oSB2E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=aSsG9uGlEy9ldSAQpiJBXtlUt1wFsdS9zQeOiax+AeV8gW+tUGMG/ImYZgBi8syCDQ kRzftjybOGSYXk5Xa8AgNGkW9b3TZfuvjzaVKCcDDGZQ7hv7+fipTyPb/bn0l+8a0VZt xT1szQBEiurEu2RrzcimnDOjIrbyo33vh+49o= Received: by 10.114.186.14 with SMTP id j14mr9502460waf.60.1275729020668; Sat, 05 Jun 2010 02:10:20 -0700 (PDT) Received: from [192.168.1.4] ([58.39.231.84]) by mx.google.com with ESMTPS id n29sm16812807wae.4.2010.06.05.02.10.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 05 Jun 2010 02:10:20 -0700 (PDT) Message-ID: <4C0A146B.1060306@gmail.com> Date: Sat, 05 Jun 2010 17:10:03 +0800 From: Wan ZongShun User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: David Woodhouse , Eric Miao Subject: [PATCHv2 2/3] MTD/pxa: use resource_size(res) for pxa2xx-flash X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100605_051023_030714_70F10E62 X-CRM114-Status: GOOD ( 14.08 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.3.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.83.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (mcuos.com[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-mtd , linux-arm-kernel X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The size calculation is end - start + 1. But,sometimes, the '1' can be forgotten carelessly, witch will have potential risk, so use resource_size should be good habit. Signed-off-by: Wan ZongShun Acked-by: Eric Miao --- drivers/mtd/maps/pxa2xx-flash.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index d8ae634..b5bb1a4 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c @@ -70,7 +70,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) info->map.name = (char *) flash->name; info->map.bankwidth = flash->width; info->map.phys = res->start; - info->map.size = res->end - res->start + 1; + info->map.size = resource_size(res); info->parts = flash->parts; info->nr_parts = flash->nr_parts;