lkml.org 
[lkml]   [2023]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] PCI: kirin: Use devm_kasprintf()
On Sun, 12 Nov 2023, Christophe JAILLET wrote:

> Use devm_kasprintf() instead of hand writing it.
> This saves the need of an intermediate buffer.
>
> There was also no reason to use the _const() version of devm_kstrdup().
> The string was known be not constant.

was known be -> is known to be

With that fixed,

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

--
i.


> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/pci/controller/dwc/pcie-kirin.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
> index 2ee146767971..d9e3514de0a0 100644
> --- a/drivers/pci/controller/dwc/pcie-kirin.c
> +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> @@ -366,7 +366,6 @@ static int kirin_pcie_get_gpio_enable(struct kirin_pcie *pcie,
> struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> - char name[32];
> int ret, i;
>
> /* This is an optional property */
> @@ -387,9 +386,8 @@ static int kirin_pcie_get_gpio_enable(struct kirin_pcie *pcie,
> if (pcie->gpio_id_clkreq[i] < 0)
> return pcie->gpio_id_clkreq[i];
>
> - sprintf(name, "pcie_clkreq_%d", i);
> - pcie->clkreq_names[i] = devm_kstrdup_const(dev, name,
> - GFP_KERNEL);
> + pcie->clkreq_names[i] = devm_kasprintf(dev, GFP_KERNEL,
> + "pcie_clkreq_%d", i);
> if (!pcie->clkreq_names[i])
> return -ENOMEM;
> }
>
\
 
 \ /
  Last update: 2023-11-20 13:59    [W:0.126 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site