Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Vinod Koul <vkoul@kernel.org>,
	Paul Cercueil <paul@crapouillou.net>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>
Subject: Re: [PATCH v1 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails
Date: Mon, 7 Oct 2024 11:51:14 -0400	[thread overview]
Message-ID: <ZwQDcrJuW+DXMBD+@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20241007150852.2183722-4-andriy.shevchenko@linux.intel.com>

On Mon, Oct 07, 2024 at 06:06:47PM +0300, Andy Shevchenko wrote:
> In dma_request_chan() one of the kasprintf() call is not checked
> against NULL. This is completely fine right now, but make others
> aware of this aspect by adding a comment.

suggest:

Add comment in dma_request_chan() to clarify kasprintf() missing return
value check and it is correct funcationaly.

>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dmaengine.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index c1357d7f3dc6..dd4224d90f07 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -854,8 +854,8 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
>
>  found:
>  #ifdef CONFIG_DEBUG_FS
> -	chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev),
> -					  name);
> +	chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), name);
> +	/* No functional issue if it fails, users are supposed to test before use */

comments should above chan->dbg_client_name ...

No funcational issue if it is NULL because user always test it before use.

>  #endif
>
>  	chan->name = kasprintf(GFP_KERNEL, "dma:%s", name);
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>

  reply	other threads:[~2024-10-07 15:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07 15:06 [PATCH v1 0/4] dmaengine: dma_request_chan*() amendments Andy Shevchenko
2024-10-07 15:06 ` [PATCH v1 1/4] dmaengine: Replace dma_request_slave_channel() by dma_request_chan() Andy Shevchenko
2024-10-07 15:52   ` Frank Li
2024-10-08 17:08     ` Andy Shevchenko
2024-10-07 15:06 ` [PATCH v1 2/4] dmaengine: Use dma_request_channel() instead of __dma_request_channel() Andy Shevchenko
2024-10-07 16:01   ` Frank Li
2024-10-08 17:12     ` Andy Shevchenko
2024-10-07 15:06 ` [PATCH v1 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails Andy Shevchenko
2024-10-07 15:51   ` Frank Li [this message]
2024-10-08 17:16     ` Andy Shevchenko
2024-10-07 15:06 ` [PATCH v1 4/4] dmaengine: Unify checks in dma_request_chan() Andy Shevchenko
2024-10-07 16:05   ` Frank Li
2024-10-08 17:16     ` Andy Shevchenko

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=ZwQDcrJuW+DXMBD+@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=vkoul@kernel.org \
    /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