From patchwork Tue Feb 16 20:06:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 8331291 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C698F9F38B for ; Tue, 16 Feb 2016 20:07:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E26D2202EC for ; Tue, 16 Feb 2016 20:07:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6B58201F4 for ; Tue, 16 Feb 2016 20:07:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVluc-0006Pp-77; Tue, 16 Feb 2016 20:07:54 +0000 Received: from userp1040.oracle.com ([156.151.31.81]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVluZ-00068I-CF for linux-mediatek@lists.infradead.org; Tue, 16 Feb 2016 20:07:52 +0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u1GK7Gaa018786 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Feb 2016 20:07:16 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u1GK7CUh000883 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 16 Feb 2016 20:07:14 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u1GK789q009061; Tue, 16 Feb 2016 20:07:08 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 16 Feb 2016 12:07:07 -0800 Date: Tue, 16 Feb 2016 23:06:58 +0300 From: Dan Carpenter To: Linus Walleij , Biao Huang Subject: [patch] pinctrl: mediatek: signedness bug in mtk_pmx_gpio_request_enable() Message-ID: <20160216200658.GA9223@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0022.oracle.com [156.151.31.74] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160216_120751_879311_CA4D8FC5 X-CRM114-Status: UNSURE ( 7.19 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maoguang Meng , Axel Lin , linux-gpio@vger.kernel.org, Hongzhou Yang , kernel-janitors@vger.kernel.org, Javier Martinez Canillas , Jonas Gorski , linux-mediatek@lists.infradead.org, Matthias Brugger , Yingjoe Chen Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "muxval" stores a value from 0-255 or a negative error code. It has to be signed for the error handling to work. Fixes: 59ee9c96dd5d ('pinctrl: mediatek: Add gpio_request_enable support') Signed-off-by: Dan Carpenter Reviewed-by: Axel Lin diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index cbc2204..1fbaf28 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -755,14 +755,14 @@ static int mtk_pmx_gpio_request_enable(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned offset) { - unsigned long muxval; + int muxval; struct mtk_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); muxval = mtk_pmx_find_gpio_mode(pctl, offset); if (muxval < 0) { dev_err(pctl->dev, "invalid gpio pin %d.\n", offset); - return -EINVAL; + return muxval; } mtk_pmx_set_mode(pctldev, offset, muxval);