提交 ae797449 编写于 作者: J Jean Delvare 提交者: Linus Torvalds

firmware/dmi_scan: drop OOM messages

As reported by Joe Perches: OOM messages generally aren't useful.
dmi_alloc is either a trivial front-end to kzalloc, and kzalloc already
does a dump_stack() when OOM, or for x86, dmi_alloc uses extend_brk
which BUGs when unsuccessful.

So we can remove all 6 such log messages in the dmi_scan driver, to
shrink the binary size (by 528 bytes on x86_64.)
Signed-off-by: NJean Delvare <jdelvare@suse.de>
Reported-by: NJoe Perches <joe@perches.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 ffbbb96d
...@@ -62,8 +62,6 @@ static const char * __init dmi_string(const struct dmi_header *dm, u8 s) ...@@ -62,8 +62,6 @@ static const char * __init dmi_string(const struct dmi_header *dm, u8 s)
str = dmi_alloc(len); str = dmi_alloc(len);
if (str != NULL) if (str != NULL)
strcpy(str, bp); strcpy(str, bp);
else
pr_err("dmi_string: cannot allocate %Zu bytes.\n", len);
return str; return str;
} }
...@@ -219,10 +217,8 @@ static void __init dmi_save_one_device(int type, const char *name) ...@@ -219,10 +217,8 @@ static void __init dmi_save_one_device(int type, const char *name)
return; return;
dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1); dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
if (!dev) { if (!dev)
pr_err("dmi_save_one_device: out of memory.\n");
return; return;
}
dev->type = type; dev->type = type;
strcpy((char *)(dev + 1), name); strcpy((char *)(dev + 1), name);
...@@ -258,10 +254,8 @@ static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm) ...@@ -258,10 +254,8 @@ static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
continue; continue;
dev = dmi_alloc(sizeof(*dev)); dev = dmi_alloc(sizeof(*dev));
if (!dev) { if (!dev)
pr_err("dmi_save_oem_strings_devices: out of memory.\n");
break; break;
}
dev->type = DMI_DEV_TYPE_OEM_STRING; dev->type = DMI_DEV_TYPE_OEM_STRING;
dev->name = devname; dev->name = devname;
...@@ -277,18 +271,14 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm) ...@@ -277,18 +271,14 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
void *data; void *data;
data = dmi_alloc(dm->length); data = dmi_alloc(dm->length);
if (data == NULL) { if (data == NULL)
pr_err("dmi_save_ipmi_device: out of memory.\n");
return; return;
}
memcpy(data, dm, dm->length); memcpy(data, dm, dm->length);
dev = dmi_alloc(sizeof(*dev)); dev = dmi_alloc(sizeof(*dev));
if (!dev) { if (!dev)
pr_err("dmi_save_ipmi_device: out of memory.\n");
return; return;
}
dev->type = DMI_DEV_TYPE_IPMI; dev->type = DMI_DEV_TYPE_IPMI;
dev->name = "IPMI controller"; dev->name = "IPMI controller";
...@@ -303,10 +293,9 @@ static void __init dmi_save_dev_onboard(int instance, int segment, int bus, ...@@ -303,10 +293,9 @@ static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
struct dmi_dev_onboard *onboard_dev; struct dmi_dev_onboard *onboard_dev;
onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1); onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
if (!onboard_dev) { if (!onboard_dev)
pr_err("dmi_save_dev_onboard: out of memory.\n");
return; return;
}
onboard_dev->instance = instance; onboard_dev->instance = instance;
onboard_dev->segment = segment; onboard_dev->segment = segment;
onboard_dev->bus = bus; onboard_dev->bus = bus;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册