uio: uio_dmem_genirq: check the return value of devm_kasprintf()

devm_kasprintf() can fail so check its return value and bail-out on no
memory.

Fixes: 52e2dc2ce2d8 ("uio: Convert a few more users to using %pOFn instead of device_node.name")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20241202181703.28546-1-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Bartosz Golaszewski 2024-12-02 19:17:03 +01:00 committed by Greg Kroah-Hartman
parent efc7ae3f24
commit a6e2087365

View File

@ -167,6 +167,8 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
}
uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
pdev->dev.of_node);
if (!uioinfo->name)
return -ENOMEM;
uioinfo->version = "devicetree";
}