On 02/15/2018 11:53 AM, Corey Minyard wrote: > On 02/15/2018 09:07 AM, Prarit Bhargava wrote: >> The ipmi_dmi_info struct is added on IPMI device initialization failure >> resulting in incorrect data in the ipmi_dmi_infos list. > > No, that list has nothing to do with the platform device.
It shows up in ipmi_dmi_infos even if the platform device init fails. > >> Drop the "out of memory warning" and only add the ipmi_dmi_info struct on >> IPMI device initialization on success. > > Yeah, I need to stop doing the warnings on memory allocation. Removing the > warning > is ok. The other changes are not. P. > > -corey > >> >> Signed-off-by: Prarit Bhargava <pra...@redhat.com> >> Cc: Corey Minyard <miny...@acm.org> >> --- >> drivers/char/ipmi/ipmi_dmi.c | 22 ++++++++++------------ >> 1 file changed, 10 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c >> index c5112b17d7ea..ccd9a85ba2c1 100644 >> --- a/drivers/char/ipmi/ipmi_dmi.c >> +++ b/drivers/char/ipmi/ipmi_dmi.c >> @@ -89,18 +89,6 @@ static void __init dmi_add_platform_ipmi(unsigned long >> base_addr, >> set_prop_entry(p[pidx++], "slave-addr", u8, slave_addr); >> set_prop_entry(p[pidx++], "addr-source", u8, SI_SMBIOS); >> - info = kmalloc(sizeof(*info), GFP_KERNEL); >> - if (!info) { >> - pr_warn("ipmi:dmi: Could not allocate dmi info\n"); >> - } else { >> - info->si_type = si_type; >> - info->flags = flags; >> - info->addr = base_addr; >> - info->slave_addr = slave_addr; >> - info->next = ipmi_dmi_infos; >> - ipmi_dmi_infos = info; >> - } >> - >> pdev = platform_device_alloc(name, ipmi_dmi_nr); >> if (!pdev) { >> pr_err("ipmi:dmi: Error allocation IPMI platform device\n"); >> @@ -168,6 +156,16 @@ static void __init dmi_add_platform_ipmi(unsigned long >> base_addr, >> goto err; >> } >> + info = kmalloc(sizeof(*info), GFP_KERNEL); >> + if (info) { >> + info->si_type = si_type; >> + info->flags = flags; >> + info->addr = base_addr; >> + info->slave_addr = slave_addr; >> + info->next = ipmi_dmi_infos; >> + ipmi_dmi_infos = info; >> + } >> + >> ipmi_dmi_nr++; >> return; >> > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openipmi-developer mailing list Openipmi-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openipmi-developer