diff --git a/device/device.c b/device/device.c index b6bc87bff0..0fce2fec93 100644 --- a/device/device.c +++ b/device/device.c @@ -221,10 +221,6 @@ struct device *alloc_dev(struct bus *parent, struct device_path *path, last_dev_p = &dev->next; /* Give the device a name. */ - dev->dtsname = malloc(32); - if (dev->dtsname == NULL) { - die("DEV: out of memory.\n"); - } sprintf(dev->dtsname, "dynamic %s", dev_path(dev)); // spin_unlock(&dev_lock); diff --git a/include/device/device.h b/include/device/device.h index 8b67ad64bb..f66234d8ba 100644 --- a/include/device/device.h +++ b/include/device/device.h @@ -169,6 +169,7 @@ struct bus { #define MAX_RESOURCES 12 #define MAX_LINKS 8 +#define MAX_DTSNAME_SIZE 64 /* * There is one device structure for each slot-number/function-number * combination: @@ -181,7 +182,7 @@ struct device { struct device * next; /* chain of all devices */ struct device_path path; - char * dtsname; /* the name from the dts */ + char dtsname[MAX_DTSNAME_SIZE]; /* the name from the dts */ unsigned vendor; unsigned device; unsigned int class; /* 3 bytes: (base,sub,prog-if) */