From patchwork Mon Oct 8 08:39:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1564511 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 687C53FC1A for ; Mon, 8 Oct 2012 08:43:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TL8tw-0002Fj-JP; Mon, 08 Oct 2012 08:41:25 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TL8sj-0001iz-BH for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2012 08:40:10 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBK000XRFYO1XW0@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2012 17:39:41 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-53-5072914db9cf Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 78.7E.03783.D4192705; Mon, 08 Oct 2012 17:39:41 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBK0094QG1I1U90@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2012 17:39:41 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/16] pinctrl: samsung: Detect and handle unsupported configuration types Date: Mon, 08 Oct 2012 10:39:03 +0200 Message-id: <1349685556-23718-4-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349685556-23718-1-git-send-email-t.figa@samsung.com> References: <1349685556-23718-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQV3fiUUBBq/+m1hsenyN1YHRY/OS +gDGKC6blNSczLLUIn27BK6MO5fOsRScZKvYe7SHrYFxI2sXIyeHhICJxNtL+5ghbDGJC/fW s3UxcnEICUxnlDg9fTYjhLOZSeLttbksIFVsAmoSnxsesYHYIgIaElO6HrOD2MwCk5kkji1I B7GFBWIkXtz5yQhiswioSqyd/RRsG6+Ak8TR/s9MENvkJZ7e7wObwyngLHHy53ywGiGgmiWX LrNMYORdwMiwilE0tSC5oDgpPddQrzgxt7g0L10vOT93EyPY58+kdjCubLA4xCjAwajEw/tB ryhAiDWxrLgy9xCjBAezkghvaj9QiDclsbIqtSg/vqg0J7X4EKM0B4uSOG+zR0qAkEB6Yklq dmpqQWoRTJaJg1OqgdEqgqvYIeuMkGPZ7lqThTrsmt3sSgyzZLU+fWxo++ER9mXVmiVWcxdu fdSlJsJgskLM411zutpMeZ9ec92Dy/S5bmve3PBPPzpiuVdx57YY92dh4t596x7dixdmulOV p8EWYeLzdQ3D+9QNj/cz3uH8fLny5KE/T5cwLrrV4rIle+qetD9fU5RYijMSDbWYi4oTAWIm zwz1AQAA 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.24 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, 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);