From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD531C433FE for ; Sun, 2 Oct 2022 22:50:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229458AbiJBWuS (ORCPT ); Sun, 2 Oct 2022 18:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiJBWuB (ORCPT ); Sun, 2 Oct 2022 18:50:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1AFAB1F7; Sun, 2 Oct 2022 15:49:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84E0460EBA; Sun, 2 Oct 2022 22:49:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA145C433B5; Sun, 2 Oct 2022 22:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664750980; bh=TyREBzyre60IBy24xJfvU5P0XRa2Pc9FiHrPgZyW9FM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S9aTGVRKAu4aXdzspozR0if7rpgH+fWdfMzmTIEjSIDue8f7YCRYyiWNrEcjuUAue CJ6TqWjSUzfbt75aZXkNh7gJ3L7Xespfy5eIUtHumQDWfhWA2TA+25902bljLNypSy nVDRvgIaRw3sYkjBOSIeGv7oblxmZewYpmo+3Dk3pwUDnKmrd/jtjDwCHfkHoe0H3P JHV4oJTKmwAseSByJ4kA/h+8HuHTbTFK6IbLBWHiJHB7aaO/2dY2rAQZja9xBf945s KNQ/LJiJs7GTKpKC7aZekf2UjXSd69FNU4pXkc8eSV5J21s/+PNr25yJrDmKQDhpRN FfXtEmDfEI4Zw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Swati Agarwal , Vinod Koul , Sasha Levin , michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com, lars@metafoo.de, adrianml@alumnos.upm.es, shravya.kumbham@xilinx.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.19 06/29] dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling Date: Sun, 2 Oct 2022 18:48:59 -0400 Message-Id: <20221002224922.238837-6-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221002224922.238837-1-sashal@kernel.org> References: <20221002224922.238837-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Swati Agarwal [ Upstream commit 91df7751eb890e970afc08f50b8f0fa5ea39e03d ] Add missing cleanup in devm_platform_ioremap_resource(). When probe fails remove dma channel resources and disable clocks in accordance with the order of resources allocated . Signed-off-by: Swati Agarwal Link: https://lore.kernel.org/r/20220817061125.4720-2-swati.agarwal@xilinx.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/xilinx/xilinx_dma.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index cd62bbb50e8b..ba0dccaa8cf1 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -3160,9 +3160,10 @@ static int xilinx_dma_probe(struct platform_device *pdev) /* Request and map I/O memory */ xdev->regs = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(xdev->regs)) - return PTR_ERR(xdev->regs); - + if (IS_ERR(xdev->regs)) { + err = PTR_ERR(xdev->regs); + goto disable_clks; + } /* Retrieve the DMA engine properties from the device tree */ xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0); xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2; @@ -3259,7 +3260,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) for_each_child_of_node(node, child) { err = xilinx_dma_child_probe(xdev, child); if (err < 0) - goto disable_clks; + goto error; } if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { @@ -3294,12 +3295,12 @@ static int xilinx_dma_probe(struct platform_device *pdev) return 0; -disable_clks: - xdma_disable_allclks(xdev); error: for (i = 0; i < xdev->dma_config->max_channels; i++) if (xdev->chan[i]) xilinx_dma_chan_remove(xdev->chan[i]); +disable_clks: + xdma_disable_allclks(xdev); return err; } -- 2.35.1