dm: avoid NULL dereference in add_item()

acpi_add_other_item() passes dev = NULL. Instead of dev->name write the
string "other" to the debug log:

    ACPI: Writing ACPI tables at 1fd3000
    0base: writing table '<NULL>'
    * other: Added type 3, 0000000011fd4000, size 240
    1facs: writing table 'FACS'
    * other: Added type 3, 0000000011fd4240, size 40
    5csrt: writing table 'CSRT'
    * other: Added type 3, 0000000011fd4280, size 30

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Heinrich Schuchardt 2022-07-10 15:40:22 +02:00 committed by Simon Glass
parent 6e15cda270
commit 53fbaa4a4a

View File

@ -159,8 +159,8 @@ static int add_item(struct acpi_ctx *ctx, struct udevice *dev,
memcpy(item->buf, start, item->size);
}
item_count++;
log_debug("* %s: Added type %d, %p, size %x\n", dev->name, type, start,
item->size);
log_debug("* %s: Added type %d, %p, size %x\n",
dev ? dev->name : "other", type, start, item->size);
return 0;
}