From patchwork Thu Aug 29 06:48:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jianzheng X-Patchwork-Id: 13782645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4EFCC7EE2C for ; Thu, 29 Aug 2024 06:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=jzQ8NcFNTrNHokkGkI1JW3pZUHqP5+ZNDRLysl8XwR4=; b=0LqYvdzzVnCdh5FK2Z3Qol3uur +DhZPbVLclPOS1Mg1G3HGCAm138AM6z3bWCiQXmC2nUOi8LUmqkfKQh71SiWmWMiWenCsbGUe2XJP 9CEA5rJXqgbhax1OA4by+bJtfj+WYsPdBrF1tM3TvyKcE4ag1mduqY/KOBzOdjb37Ir2sezvyfPIc DLNP3o3ghczB/ZxhrN+mxvKTRhzo1A+m8IY1jqIIYezQq36sLMce5xxtNpAlEqfaRin2j8rEeTUO3 OGrwg/vnw8+aqq0jUdyg/2+nfAw2dvUce5hFgGu+5aMgt0Sn1kVmhWrlo5njyLC6SGeCPJ4TsTiRJ y0kHU/1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYyn-00000000qST-0dzx; Thu, 29 Aug 2024 06:50:01 +0000 Received: from mail-sgaapc01on2060c.outbound.protection.outlook.com ([2a01:111:f400:feab::60c] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYxg-00000000qBG-307o for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:48:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cawSLVcrKRu7ev0bDZ6wl57cxauMV2zoLSROmT05RElrfYfeosbydWYdoybeCrNtv63Em0OtTi4bYD1bKUEmsxLhRgd9xPK8jxMSjdquLGAUEudoadopTo0lCua3yp16lmd66FXWlLOoxBAR+1FbCaeuBRAE71nErP5CKAGvM480wqdCZhhtgRn+hV7UiwfJBnqVoe8PuJjkLvBsTyZW74a2RNOsaCtVr6Lnx+CSB1KUb3QUPfIxkRCDQssJSBNmJHOwI+aDxFzsexSgMEunVj//h/+u8N+0hRNjCQJL6f/kgkUn+xm4tpLgGTfOYUd4yfAn39YU1dA7Eoum5hsqCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jzQ8NcFNTrNHokkGkI1JW3pZUHqP5+ZNDRLysl8XwR4=; b=gn9XNRu6dNkUEsG3l8WTVAV47x/4YcrjnquZMHW6wlhWD1nWSzLIoh62QYDx30GDaCLsE5rCMaJIVqMvdm9rVcJDDQQCkplIcz61AVF9batjpO1MU7E7/R4MDuHaf6neDCYC4v2WeZe2b20yUq2dr99yDPcZnVSpxeRQ4LI9Y1cx8Ztala2auxuFGMmj8ggtFyZM4w5/ieukVRPy1Jpt/7KV2G2lswulDbSCjs5gAfH3lUi5pzzgYcBxdAoDQoEHNPW/eyZYaA3U3IXQXRnir+g5k8CF7CPPEoyvgETrdXifvxN+cseCWfi2EG2l2TVoSKzLTUprmp2PFZjP4oq3tA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jzQ8NcFNTrNHokkGkI1JW3pZUHqP5+ZNDRLysl8XwR4=; b=T/XSYSJe+Be8LduBgmkTO9Oj1P7CV84JeDd7Ba8saGIQQX50WWsGko2ar4HmPwEtB6oGxRX5wjhGaLEKEl7DS/UK44cTFb2aDpRwibHyZwJgI7k8rFVOP0e/lNLjXa9AbwAvxiF0EBdunBKuSJ73b0U/PVoDu1DJWIvZCnsUbRmFFnJVtcZ+Ae1yULuv4fuLylO304fKymNsrk3axVbG2dONx++tmqcV+o4IknhFee71wSmTcrbdIgfbRCCQIBN9p6fyWUvfjySXDGc2VuTuqbUKJfwMfe1BsKEG9vsgsuj4l/Y6pyK6OzfQkR4IF+HXwKrY+Ga5wMtUwYS3fdRuEg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from KL1PR0601MB4211.apcprd06.prod.outlook.com (2603:1096:820:23::14) by SEYPR06MB6822.apcprd06.prod.outlook.com (2603:1096:101:1b0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Thu, 29 Aug 2024 06:48:37 +0000 Received: from KL1PR0601MB4211.apcprd06.prod.outlook.com ([fe80::29e8:8083:a2b3:bd1a]) by KL1PR0601MB4211.apcprd06.prod.outlook.com ([fe80::29e8:8083:a2b3:bd1a%4]) with mapi id 15.20.7897.027; Thu, 29 Aug 2024 06:48:37 +0000 From: Wang Jianzheng To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Linus Walleij , Jason Cooper , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Marvell Kirkwood and Armada 370, 375, 38x,...), linux-gpio@vger.kernel.org (open list:PIN CONTROL SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, wangjianzheng@vivo.com Subject: [PATCH 2/5] pinctrl: mvebu: Fix devinit_dove_pinctrl_probe function Date: Thu, 29 Aug 2024 14:48:23 +0800 Message-Id: <20240829064823.19808-1-wangjianzheng@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR06CA0237.apcprd06.prod.outlook.com (2603:1096:4:ac::21) To KL1PR0601MB4211.apcprd06.prod.outlook.com (2603:1096:820:23::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4211:EE_|SEYPR06MB6822:EE_ X-MS-Office365-Filtering-Correlation-Id: 3456e627-0282-4363-a47d-08dcc7f69c22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: 56WJ1+pLKOI2aDbmer1F+625RG3YvMg37TSBxA/OvxNEcXW2eJPZFhSpbI7jLQzGEQLXWekCKiQd2j8taHOmoud3g1aa26Vh74Rh3BPESewi83KYHsd2/lxNgvlV1asIcJGrlGmBrYwWXVxBgQ5jQbotbFLuRC9HckxtSFBBScDwlNPXNMPGn6burmCPbmLm0VcpFnrS1z2EmaplXlDh8moFXVS3eawXC46gUPgKrdXpWzQcMPwNo28EOv1sv0kGebmYkbJB6IVO6MBTSJYEI9YTSNpdWAG4Zxt3XU/8VmpDzIt08NZDWu+v2feSnGxi1EXOIejMZ09NBbM8FS22mKvizQ/YKVjVrdGhPwd4oVYKzPb0q35uy7yJqBMEcLisWS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255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:KL1PR0601MB4211.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UtEGfo10kdZl9YTSu0DZjoyO9hpA74R0CijESRS7Wh6dGRqI5uux/sINJcT9aTP6LVX3p9ggnGTzbV9kj1AWc6QSXswjxxfAv6OTg1LSsjKGgqvY4coSslqd+dTDL0GqCWEkO7W/erh56kUriOff2N72VMBTHfS21hIQ/8aQjW0E0houxsM+E3Np05QL9sDK9Ixnu1eUdocRPJRDhvkOiSEmYEjqBrE6XbeYKHDJQgZbfmnYQLYl4o8SA6Vbp0p4jxuSWFI0QPXd5mEdzcqZGk5oUpOmdfI2dLfdhG/A4lIqNgMuBTj6NPV3jrVxc9tZT/MACGGav2V4wTOw/QLZrm8xqujyuGFhMIqVaHZ001NS6BGv/lt1KhdDZUuE2oNEcAaJocz7bBn1Fuj6nrbHvCBK/+t7Vz+l6Gb8HkoIM5SoWCPSbvJFhH1NK+sRYjHIVk3Q29DWtjWGYONzHyNokLpYqJByQOU3WorOPJoU878qw516aSvOBz3r39OIDPhoZLJS8P30+VI3C3ctF7qZbqEKD2LcCamundqzdv10lyp/jcKUWBWxs7eapLZw8ePKchwevZj3/QBVqlHNd0niNP3mr33rBCI8+It3PWsV9FJWAEJrIPNno6iLy/EBS/d6Y2g3GSTj3qIvEmewyb0q+vBy2klQpHwf8DTCrgoTueVnuMwPkVf9ppOk5eyFRVcQUK6jPpv5257xdVr5y+o8Nh4Dkg4ACQSZ5UrwopmEJUapjkkoMLP83hXr5me8lGLGjHFLG8ykyrLWC1fp5UleNF7kA670wmo0WCdCi34IaFW3/qtGKrWNEgyN6c/MIlzgAs5ov/+K+IHd9IE+GJXqTB7yoPLPFRwcS5YhqPRzQzR4MmuhDQsEc8OuX1g30F/NlVhK8MQIa6RC0ER8Tsvhf7rKBSXTFqVulWxuW3m2sqrFsKgofvMn8644Lx3f+541CrVhk8hDtBf+Np93m5cStIvywK1UoASJTj/mWehn6Nef8AS3t4BbWTua6Fk9NsRth2RlJamk2Blf7/1Gw5ArzfupMakZtXke9Dv7U3Wtl3rhFpntTiMk/haR9ceidhYRz6YPYa3/b7AJ/gxpRYbVVFJe/lHMiYNtu/rOoj2wah+IT7N39ACroV7PvPhMqlymoWpbQ95Gt2yqYULb2be+yJgpu0/kkr6sBD7iB29pi6c8+Hz0rbCRIXhFGSiEnFSOAWTVJvh/io59vB2zeYqC+gO0xgQg1LcxIiceX9d8V9LkCay6ARE/dioOcZA2xyyX3+U8XNlR3iKRB/BvLZ1IIGy8VXqsFaqPmH6WYglDz8cY7Ilpv2tumJvIJxRcD0GluKR6CV2H1BWUyxx4ZDn5idxKq7cVvOsFQ+uom54hec3nJIvM3Kp5SghG3DUGH0qmyHoIlm/OiP93FBvVmkKi2FQlESfSd0fWh6WAxKcPAK8f1FCeFI/ueA90XI7f10aKCLyw5reXX93kuzfs77V2I+jvHsHlAR31AfEH8nF9Uub0Jp8bcgR8RsLEwMXKoEt0xvp0NN2pxQPX/sNrQmPQV6l9/FUdSEAVXGcVEWtB7KSyR6RIQZeYFaCr5LS26v1u X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3456e627-0282-4363-a47d-08dcc7f69c22 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4211.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 06:48:37.6554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ET8ynPCwQeUO0VRZte9Y5xWNiUK9yP13lri9E5dYtvdx76SjmiR0UF2SuoSryoRuvxYqXL/0QizNP+XVC04e+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6822 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_234852_782249_18C91C77 X-CRM114-Status: GOOD ( 13.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When an eroor occurs during the execution of the function __devinit_dove_pinctrl_probe, the clk is not properly disabled. Fix this by calling clk_disable_unprepare before return. Fixes: ba607b6238a1 ("pinctrl: mvebu: make pdma clock on dove mandatory") Signed-off-by: Wang Jianzheng --- drivers/pinctrl/mvebu/pinctrl-dove.c | 42 +++++++++++++++++++--------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index 1947da73e512..dce601d99372 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -767,7 +767,7 @@ static int dove_pinctrl_probe(struct platform_device *pdev) struct resource fb_res; struct mvebu_mpp_ctrl_data *mpp_data; void __iomem *base; - int i; + int i, ret; pdev->dev.platform_data = (void *)device_get_match_data(&pdev->dev); @@ -783,13 +783,17 @@ static int dove_pinctrl_probe(struct platform_device *pdev) clk_prepare_enable(clk); base = devm_platform_get_and_ioremap_resource(pdev, 0, &mpp_res); - if (IS_ERR(base)) - return PTR_ERR(base); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + goto err_probe; + } mpp_data = devm_kcalloc(&pdev->dev, dove_pinctrl_info.ncontrols, sizeof(*mpp_data), GFP_KERNEL); - if (!mpp_data) - return -ENOMEM; + if (!mpp_data) { + ret = -ENOMEM; + goto err_probe; + } dove_pinctrl_info.control_data = mpp_data; for (i = 0; i < ARRAY_SIZE(dove_mpp_controls); i++) @@ -808,8 +812,10 @@ static int dove_pinctrl_probe(struct platform_device *pdev) } mpp4_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(mpp4_base)) - return PTR_ERR(mpp4_base); + if (IS_ERR(mpp4_base)) { + ret = PTR_ERR(mpp4_base); + goto err_probe; + } res = platform_get_resource(pdev, IORESOURCE_MEM, 2); if (!res) { @@ -820,8 +826,10 @@ static int dove_pinctrl_probe(struct platform_device *pdev) } pmu_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(pmu_base)) - return PTR_ERR(pmu_base); + if (IS_ERR(pmu_base)) { + ret = PTR_ERR(pmu_base); + goto err_probe; + } gconfmap = syscon_regmap_lookup_by_compatible("marvell,dove-global-config"); if (IS_ERR(gconfmap)) { @@ -831,12 +839,17 @@ static int dove_pinctrl_probe(struct platform_device *pdev) adjust_resource(&fb_res, (mpp_res->start & INT_REGS_MASK) + GC_REGS_OFFS, 0x14); gc_base = devm_ioremap_resource(&pdev->dev, &fb_res); - if (IS_ERR(gc_base)) - return PTR_ERR(gc_base); + if (IS_ERR(gc_base)) { + ret = PTR_ERR(gc_base); + goto err_probe; + } + gconfmap = devm_regmap_init_mmio(&pdev->dev, gc_base, &gc_regmap_config); - if (IS_ERR(gconfmap)) - return PTR_ERR(gconfmap); + if (IS_ERR(gconfmap)) { + ret = PTR_ERR(gconfmap); + goto err_probe; + } } /* Warn on any missing DT resource */ @@ -844,6 +857,9 @@ static int dove_pinctrl_probe(struct platform_device *pdev) dev_warn(&pdev->dev, FW_BUG "Missing pinctrl regs in DTB. Please update your firmware.\n"); return mvebu_pinctrl_probe(pdev); +err_probe: + clk_disable_unprepare(clk); + return ret; } static struct platform_driver dove_pinctrl_driver = {