mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
misc: open-dice: do not assume dev->of_node is valid
dev->of_node is not null only when the device is configured via device tree. When the matching device is configured by other means (like ACPI), the current code will cause null pointer dereference. Signed-off-by: Song Guo <songguo@google.com> Link: https://patch.msgid.link/20260715122146.4069884-2-songguo@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9bdecb9173
commit
b072266078
|
|
@ -118,13 +118,18 @@ static int __init open_dice_probe(struct platform_device *pdev)
|
|||
{
|
||||
static unsigned int dev_idx;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct reserved_mem *rmem;
|
||||
struct reserved_mem *rmem = NULL;
|
||||
struct open_dice_drvdata *drvdata;
|
||||
int ret;
|
||||
|
||||
rmem = of_reserved_mem_lookup(dev->of_node);
|
||||
if (!rmem) {
|
||||
dev_err(dev, "failed to lookup reserved memory\n");
|
||||
if (dev->of_node) {
|
||||
rmem = of_reserved_mem_lookup(dev->of_node);
|
||||
if (!rmem) {
|
||||
dev_err(dev, "failed to lookup reserved memory\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
dev_err(dev, "device not supported (no DT node)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user