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 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 F155ACCA470 for ; Tue, 30 Sep 2025 12:16:56 +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:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Owner; bh=DT3kmmoCh/QqwpiEzn8+Wg1aSuJs0OQeflPRtSBj4OA=; b=S6DibI1ms9v0cUg2g29u2wrnbM RnU2ETqvCphPL0Lnc9bqwQGh4RgN36g5Ij4MiOqO5JN6epgd3HDdPeKmrFUfeJA0RPFJMi4oHY2eT Mv350DNjH3XkWp9A3ZK0jfhQlJpfGy/FUDL8PSzziCrzsX91UGAx0e4Th67Bi8f+rcfchTMet6TNY KhSAVLupw64+9xUuFwY+au4rIxuOepZ+mFVlgmcbETPoTi1x4U3aufgRQyaE0s7X8tp1rmndhqGG9 UyqNICrYMl6jjN8RSxRsNcoCl0x3x/6s95scp3Y6LLQAYg0Y6Xcbr/E9Hjj67L08koVRB8BUpeJO/ KSCrUPwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v3ZHm-00000005ELK-3vvO; Tue, 30 Sep 2025 12:16:50 +0000 Received: from lelvem-ot02.ext.ti.com ([198.47.23.235]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v3ZHZ-00000005EGD-10Fb for linux-arm-kernel@lists.infradead.org; Tue, 30 Sep 2025 12:16:39 +0000 Received: from lelvem-sh01.itg.ti.com ([10.180.77.71]) by lelvem-ot02.ext.ti.com (8.15.2/8.15.2) with ESMTP id 58UCGMaD2911947; Tue, 30 Sep 2025 07:16:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1759234582; bh=DT3kmmoCh/QqwpiEzn8+Wg1aSuJs0OQeflPRtSBj4OA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=th5fdSWa2pS7avy3CPJi20Rcr43GmjveGr5yG7lxHBPz04lInhVXVcAnRRVeLxUB4 3t1yDltwFhdAVvwDWGlfnzuyFhC8FWsGNjRxE1nC6r7Dp3jAjwQBaGhtV5Mig33r7C LC9mXPRE53fe3cFLlAb5IXcJS2LRNrroEKj5u3xg= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelvem-sh01.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 58UCGMaO2114239 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL); Tue, 30 Sep 2025 07:16:22 -0500 Received: from DFLE209.ent.ti.com (10.64.6.67) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Tue, 30 Sep 2025 07:16:21 -0500 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DFLE209.ent.ti.com (10.64.6.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Tue, 30 Sep 2025 07:16:21 -0500 Received: from localhost (uda0133052.dhcp.ti.com [128.247.81.232]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 58UCGLwc2892161; Tue, 30 Sep 2025 07:16:21 -0500 From: Nishanth Menon To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Andrew Lunn CC: Santosh Shilimkar , Simon Horman , Siddharth Vadapalli , , , , Nishanth Menon Subject: [PATCH V2 2/3] soc: ti: knav_dma: Make knav_dma_open_channel return NULL on error Date: Tue, 30 Sep 2025 07:16:08 -0500 Message-ID: <20250930121609.158419-3-nm@ti.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250930121609.158419-1-nm@ti.com> References: <20250930121609.158419-1-nm@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250930_051637_370118_2CE4C82A X-CRM114-Status: GOOD ( 14.36 ) 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 Make knav_dma_open_channel consistently return NULL on error instead of ERR_PTR. Currently the header include/linux/soc/ti/knav_dma.h returns NUL when the driver is disabled, but the driver implementation returns ERR_PTR(-EINVAL), creating API inconsistency for users. Standardize the error handling by making the function return NULL on all error conditions. Suggested-by: Simon Horman Signed-off-by: Nishanth Menon --- Changes in V2: * renewed version drivers/soc/ti/knav_dma.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index a25ebe6cd503..e69f0946de29 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c @@ -402,7 +402,7 @@ static int of_channel_match_helper(struct device_node *np, const char *name, * @name: slave channel name * @config: dma configuration parameters * - * Returns pointer to appropriate DMA channel on success or error. + * Returns pointer to appropriate DMA channel on success or NULL on error. */ void *knav_dma_open_channel(struct device *dev, const char *name, struct knav_dma_cfg *config) @@ -414,13 +414,13 @@ void *knav_dma_open_channel(struct device *dev, const char *name, if (!kdev) { pr_err("keystone-navigator-dma driver not registered\n"); - return (void *)-EINVAL; + return NULL; } chan_num = of_channel_match_helper(dev->of_node, name, &instance); if (chan_num < 0) { dev_err(kdev->dev, "No DMA instance with name %s\n", name); - return (void *)-EINVAL; + return NULL; } dev_dbg(kdev->dev, "initializing %s channel %d from DMA %s\n", @@ -431,7 +431,7 @@ void *knav_dma_open_channel(struct device *dev, const char *name, if (config->direction != DMA_MEM_TO_DEV && config->direction != DMA_DEV_TO_MEM) { dev_err(kdev->dev, "bad direction\n"); - return (void *)-EINVAL; + return NULL; } /* Look for correct dma instance */ @@ -443,7 +443,7 @@ void *knav_dma_open_channel(struct device *dev, const char *name, } if (!dma) { dev_err(kdev->dev, "No DMA instance with name %s\n", instance); - return (void *)-EINVAL; + return NULL; } /* Look for correct dma channel from dma instance */ @@ -463,14 +463,14 @@ void *knav_dma_open_channel(struct device *dev, const char *name, if (!chan) { dev_err(kdev->dev, "channel %d is not in DMA %s\n", chan_num, instance); - return (void *)-EINVAL; + return NULL; } if (atomic_read(&chan->ref_count) >= 1) { if (!check_config(chan, config)) { dev_err(kdev->dev, "channel %d config miss-match\n", chan_num); - return (void *)-EINVAL; + return NULL; } } -- 2.47.0