From: Jacob Keller <jacob.e.keller@intel.com>
To: "Nishanth Menon" <nm@ti.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
"Andrew Lunn" <andrew+netdev@lunn.ch>
Cc: Santosh Shilimkar <ssantosh@kernel.org>,
Simon Horman <horms@kernel.org>,
Siddharth Vadapalli <s-vadapalli@ti.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH V2 2/3] soc: ti: knav_dma: Make knav_dma_open_channel return NULL on error
Date: Tue, 30 Sep 2025 16:59:17 -0700 [thread overview]
Message-ID: <c8d9f60a-341a-4386-afc6-b7a9451cda9f@intel.com> (raw)
In-Reply-To: <20250930121609.158419-3-nm@ti.com>
[-- Attachment #1.1: Type: text/plain, Size: 1764 bytes --]
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@kernel.org>
> Signed-off-by: Nishanth Menon <nm@ti.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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2025-09-30 23:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 12:16 [PATCH V2 0/3] soc: ti: Fix crash in error path when DMA channel open fails Nishanth Menon
2025-09-30 12:16 ` [PATCH V2 1/3] net: ethernet: ti: netcp: Handle both ERR_PTR and NULL from knav_dma_open_channel Nishanth Menon
2025-09-30 12:16 ` [PATCH V2 2/3] soc: ti: knav_dma: Make knav_dma_open_channel return NULL on error Nishanth Menon
2025-09-30 23:59 ` Jacob Keller [this message]
2025-10-01 10:57 ` Nishanth Menon
2025-09-30 12:16 ` [PATCH V2 3/3] net: ethernet: ti: Remove IS_ERR_OR_NULL checks for knav_dma_open_channel Nishanth Menon
2025-09-30 23:59 ` Jacob Keller
2025-10-01 10:54 ` Nishanth Menon
2025-10-01 15:58 ` Simon Horman
2025-10-01 16:58 ` Nishanth Menon
2025-10-01 21:53 ` Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c8d9f60a-341a-4386-afc6-b7a9451cda9f@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nm@ti.com \
--cc=pabeni@redhat.com \
--cc=s-vadapalli@ti.com \
--cc=ssantosh@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox