Re: [PATCH] nvmem: meson-mx-efuse: check the return value of devm_kstrdup()

From: Martin Blumenstingl
Date: Sun Jan 16 2022 - 18:01:42 EST


Hello,

First of all: thank you for this patch!

On Sun, Jan 16, 2022 at 6:37 AM <xkernel.wang@xxxxxxxxxxx> wrote:
[...]
> @@ -211,6 +211,9 @@ static int meson_mx_efuse_probe(struct platform_device *pdev)
>
> efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name,
> GFP_KERNEL);
> + if (!efuse->config.name)
> + return -ENOMEM;
Looking at other drivers and also at drivers/nvmem/core.c I believe
that the whole devm_kstrdup is unnecessary.
Instead I think the code can be simplified as:
efuse->config.name = drvdata->name;

What do you think?


Best regards,
Martin