• Yazen Ghannam's avatar
    EDAC/amd64: Gather hardware information early · 80355a3b
    Yazen Ghannam authored
    Split out gathering hardware information from init_one_instance()
    into a separate function hw_info_get(). This is necessary so that
    the information can be cached earlier and used to check if memory is
    populated and if ECC is enabled on a node.
    
    Also, define a function hw_info_put() to back out changes made in
    hw_info_get().
    
    Check for an allocated PCI device (Function 0 for Family 17h or Function
    1 for pre-Family 17h) before freeing, since hw_info_put() may be called
    before PCI siblings are reserved.
    
    Drop the family check when freeing pvt->umc. This will be NULL on
    pre-Family 17h systems. However, kfree() is safe and will check for a
    NULL pointer before freeing.
    Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
    Cc: James Morse <james.morse@arm.com>
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
    Cc: Robert Richter <rrichter@marvell.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Link: https://lkml.kernel.org/r/20191106012448.243970-3-Yazen.Ghannam@amd.com
    80355a3b
amd64_edac.c 93.8 KB