From patchwork Tue Aug 27 09:39:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11116489 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3C391399 for ; Tue, 27 Aug 2019 09:39:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B707E20828 for ; Tue, 27 Aug 2019 09:39:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="IORazl/U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728928AbfH0Jjx (ORCPT ); Tue, 27 Aug 2019 05:39:53 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:40692 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbfH0Jjw (ORCPT ); Tue, 27 Aug 2019 05:39:52 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7R9dHnC181166; Tue, 27 Aug 2019 09:39:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2019-08-05; bh=iyPJDlzW/9Wy75yoRMq0JaYVquSmNBchUb8Dgo73hxY=; b=IORazl/Uwhr5CgFEZGNYGKpzz2Q6IRDwf6bMeBtn+dB7Cz/vfnHFul60Sog25TzNSS7m 5tDUpMQQg99tf/12Zyb/ABWZeXIdi0RIySfKVmCdHqHO4fSUZlIaNomlCnuJ7oX1Taa5 UczGHUSxoDASqJl7eO0O2gruCojIQgGFZTCYPSd08pqZe+WL1ZaEDdp85fL0h57mppwO VKPg2HCzrIEXRmNUXTGFVBgYXMxpmsx0d7zVvCXshJC0L5/AuKe2cUxvLQfECx/PTEnM j+/S3/M/O4HQ81+YAITgrvXJvli6r2HlYgPp0AySM8dmmp9Zi3Zwy8AOWHUGZBd3zVHh wQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2un1xa823a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Aug 2019 09:39:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7R9d8FK119717; Tue, 27 Aug 2019 09:39:40 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2umj283m9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Aug 2019 09:39:40 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x7R9daxZ031838; Tue, 27 Aug 2019 09:39:38 GMT Received: from mwanda (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Aug 2019 02:39:36 -0700 Date: Tue, 27 Aug 2019 12:39:27 +0300 From: Dan Carpenter To: Geert Uytterhoeven , Yoshihiro Shimoda Cc: Linus Walleij , linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux() Message-ID: <20190827093927.GB8443@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9361 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908270109 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9361 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908270109 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org We need to unlock and enable IRQs before we return on this error path. Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed") Signed-off-by: Dan Carpenter Reviewed-by: Geert Uytterhoeven Reviewed-by: Yoshihiro Shimoda --- drivers/pinctrl/sh-pfc/pinctrl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c index 99f4ebd69861..212a4a9c3a8f 100644 --- a/drivers/pinctrl/sh-pfc/pinctrl.c +++ b/drivers/pinctrl/sh-pfc/pinctrl.c @@ -361,8 +361,10 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector, * This driver cannot manage both gpio and mux when the gpio * pin is already enabled. So, this function fails. */ - if (cfg->gpio_enabled) - return -EBUSY; + if (cfg->gpio_enabled) { + ret = -EBUSY; + goto done; + } ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION); if (ret < 0)