From patchwork Thu Oct 11 08:11:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1581301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 6447B3FCFC for ; Thu, 11 Oct 2012 08:14:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMDsG-0006jx-4p; Thu, 11 Oct 2012 08:12:08 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMDrz-0006eQ-H6 for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 08:11:53 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBP005P8YRAMOI0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 17:11:38 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-15-50767f3acc42 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 7D.A5.03860.A3F76705; Thu, 11 Oct 2012 17:11:38 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBP005FVYR04E50@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 17:11:38 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 01/15] pinctrl: samsung: Detect and handle unsupported configuration types Date: Thu, 11 Oct 2012 10:11:07 +0200 Message-id: <1349943081-27939-2-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349943081-27939-1-git-send-email-t.figa@samsung.com> References: <1349943081-27939-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jAV2r+rIAg3Pf1Sw2Pb7G6sDosXlJ fQBjFJdNSmpOZllqkb5dAlfGnUvnWApOslXsPdrD1sC4kbWLkZNDQsBEYv3EgywQtpjEhXvr 2boYuTiEBBYxSpw8/YodwtnMJPHwwWwmkCo2ATWJzw2P2EBsEQENiSldj8GKmAWWMklsWzIB LCEsECNx9sVnMJtFQFXiy74FzF2MHBy8Ak4Sp3+EQGyTl3h6vw+shFPAWeLrphVg84WASs6+ fsw+gZF3ASPDKkbR1ILkguKk9FwjveLE3OLSvHS95PzcTYxgnz+T3sG4qsHiEKMAB6MSD6/D utIAIdbEsuLK3EOMEhzMSiK8l2vLAoR4UxIrq1KL8uOLSnNSiw8xSnOwKInzNnukBAgJpCeW pGanphakFsFkmTg4pRoY9VvNZ1abzImOmXkr500Ll33zix8BqStOKkzf/PLWxq+8aWcYK3u3 tD/7Gv4iTzEs2PqPaJ6U3sW5KV8OrtwzzXmm16tn7jeDncP2hwns6Ni7eb7yT9X3EyUXrbw8 tUUvLODkIVvVrjt3HHun/953lFdH565bren8HM7ym9bWyZsl+v4dVblprsRSnJFoqMVcVJwI AL+vsyj1AQAA X-Spam-Note: CRM114 invocation failed X-Spam-Score: -9.0 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, swarren@wwwdotorg.org, tony@atomide.com, devicetree-discuss@lists.ozlabs.org, tomasz.figa@gmail.com, t.figa@samsung.com, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, thomas.abraham@linaro.org, linus.walleij@linaro.org, m.szyprowski@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch modifies the pinctrl-samsung driver to detect when width of a bit field is set to zero (which means that such configuraton type is not supported) and return an error instead of trying to modify an inexistent register. Signed-off-by: Tomasz Figa --- drivers/pinctrl/pinctrl-samsung.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index dd108a9..c660fa5 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -391,6 +391,9 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin, return -EINVAL; } + if (!width) + return -EINVAL; + mask = (1 << width) - 1; shift = pin_offset * width; data = readl(reg_base + cfg_reg);