[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c8d9f60a-341a-4386-afc6-b7a9451cda9f@intel.com>
Date: Tue, 30 Sep 2025 16:59:17 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Nishanth Menon <nm@...com>, Uwe Kleine-König
<u.kleine-koenig@...libre.com>, Paolo Abeni <pabeni@...hat.com>, "Jakub
Kicinski" <kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>, "David S.
Miller" <davem@...emloft.net>, Andrew Lunn <andrew+netdev@...n.ch>
CC: Santosh Shilimkar <ssantosh@...nel.org>, Simon Horman <horms@...nel.org>,
Siddharth Vadapalli <s-vadapalli@...com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH V2 2/3] soc: ti: knav_dma: Make knav_dma_open_channel
return NULL on error
On 9/30/2025 5:16 AM, Nishanth Menon wrote:
> 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.
>
I would word this as indicating that we don't even use ERR_PTR here at all!
> Standardize the error handling by making the function return NULL on all
> error conditions.
>
> Suggested-by: Simon Horman <horms@...nel.org>
> Signed-off-by: Nishanth Menon <nm@...com>
> ---
> 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;
Wow. The driver doesn't even return ERR_PTR, but just directly casts
-EINVAL to a void *... thats quite ugly. Good to remove this.
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists