diff options
Diffstat (limited to 'drivers/char/ipmi/ipmi_dmi.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_dmi.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c index e2c143861b1e..249880457b17 100644 --- a/drivers/char/ipmi/ipmi_dmi.c +++ b/drivers/char/ipmi/ipmi_dmi.c @@ -4,6 +4,9 @@ * allow autoloading of the IPMI drive based on SMBIOS entries. */ +#define pr_fmt(fmt) "%s" fmt, "ipmi:dmi: " +#define dev_fmt pr_fmt + #include <linux/ipmi.h> #include <linux/init.h> #include <linux/dmi.h> @@ -41,7 +44,7 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, unsigned int num_r = 1, size; struct property_entry p[5]; unsigned int pidx = 0; - char *name, *override; + char *name; int rv; enum si_type si_type; struct ipmi_dmi_info *info; @@ -49,11 +52,9 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, memset(p, 0, sizeof(p)); name = "dmi-ipmi-si"; - override = "ipmi_si"; switch (type) { case IPMI_DMI_TYPE_SSIF: name = "dmi-ipmi-ssif"; - override = "ipmi_ssif"; offset = 1; size = 1; si_type = SI_TYPE_INVALID; @@ -71,7 +72,7 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, si_type = SI_SMIC; break; default: - pr_err("ipmi:dmi: Invalid IPMI type: %d\n", type); + pr_err("Invalid IPMI type: %d\n", type); return; } @@ -83,7 +84,7 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) { - pr_warn("ipmi:dmi: Could not allocate dmi info\n"); + pr_warn("Could not allocate dmi info\n"); } else { info->si_type = si_type; info->flags = flags; @@ -95,13 +96,9 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, pdev = platform_device_alloc(name, ipmi_dmi_nr); if (!pdev) { - pr_err("ipmi:dmi: Error allocation IPMI platform device\n"); + pr_err("Error allocation IPMI platform device\n"); return; } - pdev->driver_override = kasprintf(GFP_KERNEL, "%s", - override); - if (!pdev->driver_override) - goto err; if (type == IPMI_DMI_TYPE_SSIF) { p[pidx++] = PROPERTY_ENTRY_U16("i2c-addr", base_addr); @@ -141,22 +138,20 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, rv = platform_device_add_resources(pdev, r, num_r); if (rv) { - dev_err(&pdev->dev, - "ipmi:dmi: Unable to add resources: %d\n", rv); + dev_err(&pdev->dev, "Unable to add resources: %d\n", rv); goto err; } add_properties: rv = platform_device_add_properties(pdev, p); if (rv) { - dev_err(&pdev->dev, - "ipmi:dmi: Unable to add properties: %d\n", rv); + dev_err(&pdev->dev, "Unable to add properties: %d\n", rv); goto err; } rv = platform_device_add(pdev); if (rv) { - dev_err(&pdev->dev, "ipmi:dmi: Unable to add device: %d\n", rv); + dev_err(&pdev->dev, "Unable to add device: %d\n", rv); goto err; } @@ -217,6 +212,10 @@ static void __init dmi_decode_ipmi(const struct dmi_header *dm) slave_addr = data[DMI_IPMI_SLAVEADDR]; memcpy(&base_addr, data + DMI_IPMI_ADDR, sizeof(unsigned long)); + if (!base_addr) { + pr_err("Base address is zero, assuming no IPMI interface\n"); + return; + } if (len >= DMI_IPMI_VER2_LENGTH) { if (type == IPMI_DMI_TYPE_SSIF) { offset = 0; @@ -263,7 +262,7 @@ static void __init dmi_decode_ipmi(const struct dmi_header *dm) offset = 16; break; default: - pr_err("ipmi:dmi: Invalid offset: 0\n"); + pr_err("Invalid offset: 0\n"); return; } } |