From nobody Tue Dec 2 03:02:49 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A089C2D0C90; Mon, 17 Nov 2025 16:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763396005; cv=none; b=Na8WVomDrkjc9+6NCndrTP2EJcxsM54gRtkcSi19LXGTzsRDGQ4HHaXapkJAJmgXZFWrOMWJbL8BMp6nwMZi8KZK7mpYl33bvx8r5zQEovkgSoCSexTjXSaC+K9uQ92+q03ZnAOrc+Fzjb4HiMXzcaQtA6IwSKQAUFAFcV4UoWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763396005; c=relaxed/simple; bh=d7H3wTk9NdknnpBJr/9afEsXCffQd73eDOt2Nt3ybZ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CLMxMXmXwjhELd8SxbpCTPwfUljaIgbHs0IYaASDvRoRFuRw8MhQvkUaOG7bvFZs0c3ZLTVq+rG0fVKl5QcvMc9EvE0hKNSs/+/qE1CgOkA8MgXxILtTkFJxkTzXgenMJLNQgcmByrMc/J2tdEReWVmD6a9lScbDJQnza6IEznQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CjS8KJPJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CjS8KJPJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E7C8C19423; Mon, 17 Nov 2025 16:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763396005; bh=d7H3wTk9NdknnpBJr/9afEsXCffQd73eDOt2Nt3ybZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjS8KJPJCByvMHTF4347x3gr8PW4ITg0Gu5RrU3h6d2rkE1NDRc0DJDew1jGM8ncU UvpoTBZf4S2iJSPunnodDJO1HDyvcgNqFdjWxB7I+6qTGZe0fW3bolp1FpkPnOga1X y3MeRd9i/tIDDBH0n/qzhakhFTqIVum7wMhXdTWBZwsAQ9NFz0ob+NtqFblDEjlEl1 Sz/lWHdpnxihVwKRJluxNqPpx8C0tp7GRhc0+mm6jo/bE3OLtlkVAsNg+EUj9Hxvdf FaYGF10oHsRUr0pOAIYJjMLeGj2XTwJ0kSAZ6SwmZzOQAjK3GJvJqktipjSohsDMFN VQvd2XUbmXsYg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vL1r1-000000002oH-2QU9; Mon, 17 Nov 2025 17:13:23 +0100 From: Johan Hovold To: Vinod Koul Cc: Ludovic Desroches , Viresh Kumar , Andy Shevchenko , Vinicius Costa Gomes , Dave Jiang , Vladimir Zapolskiy , Piotr Wojtaszczyk , =?UTF-8?q?Am=C3=A9lie=20Delaunay?= , Maxime Coquelin , Alexandre Torgue , Peter Ujfalusi , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 14/15] dmaengine: ti: dma-crossbar: clean up dra7x route allocation error paths Date: Mon, 17 Nov 2025 17:12:57 +0100 Message-ID: <20251117161258.10679-16-johan@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251117161258.10679-1-johan@kernel.org> References: <20251117161258.10679-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use a common exit path to drop the cross platform device reference on errors for consistency with am335x. Signed-off-by: Johan Hovold --- drivers/dma/ti/dma-crossbar.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c index ff05b150ad37..e04077d542d2 100644 --- a/drivers/dma/ti/dma-crossbar.c +++ b/drivers/dma/ti/dma-crossbar.c @@ -245,28 +245,26 @@ static void *ti_dra7_xbar_route_allocate(struct of_ph= andle_args *dma_spec, { struct platform_device *pdev =3D of_find_device_by_node(ofdma->of_node); struct ti_dra7_xbar_data *xbar =3D platform_get_drvdata(pdev); - struct ti_dra7_xbar_map *map; + struct ti_dra7_xbar_map *map =3D ERR_PTR(-EINVAL); =20 if (dma_spec->args[0] >=3D xbar->xbar_requests) { dev_err(&pdev->dev, "Invalid XBAR request number: %d\n", dma_spec->args[0]); - put_device(&pdev->dev); - return ERR_PTR(-EINVAL); + goto out_put_pdev; } =20 /* The of_node_put() will be done in the core for the node */ dma_spec->np =3D of_parse_phandle(ofdma->of_node, "dma-masters", 0); if (!dma_spec->np) { dev_err(&pdev->dev, "Can't get DMA master\n"); - put_device(&pdev->dev); - return ERR_PTR(-EINVAL); + goto out_put_pdev; } =20 map =3D kzalloc(sizeof(*map), GFP_KERNEL); if (!map) { of_node_put(dma_spec->np); - put_device(&pdev->dev); - return ERR_PTR(-ENOMEM); + map =3D ERR_PTR(-ENOMEM); + goto out_put_pdev; } =20 mutex_lock(&xbar->mutex); @@ -277,8 +275,8 @@ static void *ti_dra7_xbar_route_allocate(struct of_phan= dle_args *dma_spec, dev_err(&pdev->dev, "Run out of free DMA requests\n"); kfree(map); of_node_put(dma_spec->np); - put_device(&pdev->dev); - return ERR_PTR(-ENOMEM); + map =3D ERR_PTR(-ENOMEM); + goto out_put_pdev; } set_bit(map->xbar_out, xbar->dma_inuse); mutex_unlock(&xbar->mutex); @@ -292,6 +290,7 @@ static void *ti_dra7_xbar_route_allocate(struct of_phan= dle_args *dma_spec, =20 ti_dra7_xbar_write(xbar->iomem, map->xbar_out, map->xbar_in); =20 +out_put_pdev: put_device(&pdev->dev); =20 return map; --=20 2.51.0