Skip to content

Commit

Permalink
dmi-id: fix for __you_cannot_kmalloc_that_much failure
Browse files Browse the repository at this point in the history
gcc 3.2 has a hard time coping with the code in dmi_id_init():

drivers/built-in.o(.init.text+0x789e): In function `dmi_id_init':
: undefined reference to `__you_cannot_kmalloc_that_much'
make: *** [.tmp_vmlinux1] Error 1

Moving half of the code to a separate function seems to help.  This is a
no-op for gcc 4.1 which will successfully inline the code anyway.

Signed-off-by: Jean Delvare <[email protected]>
Cc: Dave Airlie <[email protected]>
Tested-by: Kamalesh Babulal <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Jean Delvare authored and Linus Torvalds committed Jan 9, 2008
1 parent 83a08e7 commit ce8c628
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions drivers/firmware/dmi-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@ static struct device *dmi_dev;

extern int dmi_available;

static int __init dmi_id_init(void)
/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
dmi_id_init! */
static void __init dmi_id_init_attr_table(void)
{
int ret, i;

if (!dmi_available)
return -ENODEV;
int i;

/* Not necessarily all DMI fields are available on all
* systems, hence let's built an attribute table of just
Expand All @@ -205,6 +204,16 @@ static int __init dmi_id_init(void)
ADD_DMI_ATTR(chassis_serial, DMI_CHASSIS_SERIAL);
ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG);
sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr;
}

static int __init dmi_id_init(void)
{
int ret;

if (!dmi_available)
return -ENODEV;

dmi_id_init_attr_table();

ret = class_register(&dmi_class);
if (ret)
Expand Down

0 comments on commit ce8c628

Please sign in to comment.