• Dan Williams's avatar
    cxl/acpi: Fix load failures due to single window creation failure · 5c6224bf
    Dan Williams authored
    The expectation is that cxl_parse_cfwms() continues in the face the of
    failure as evidenced by code like:
    
        cxlrd = cxl_root_decoder_alloc(root_port, ways, cxl_calc_hb);
        if (IS_ERR(cxlrd))
        	return 0;
    
    There are other error paths in that function which mistakenly follow
    idiomatic expectations and return an error when they should not. Most of
    those mistakes are innocuous checks that hardly ever fail in practice.
    However, a recent change succeed in making the implementation more
    fragile by applying an idiomatic, but still wrong "fix" [1]. In this
    failure case the kernel reports:
    
        cxl root0: Failed to populate active decoder targets
        cxl_acpi ACPI0017:00: Failed to add decode range: [mem 0x00000000-0x7fffffff flags 0x200]
    
    ...which is a real issue with that one window (to be fixed separately),
    but ends up failing the entirety of cxl_acpi_probe().
    
    Undo that recent breakage while also removing the confusion about
    ignoring errors. Update all exits paths to return an error per typical
    expectations and let an outer wrapper function handle dropping the
    error.
    
    Fixes: 91019b5b ("cxl/acpi: Return 'rc' instead of '0' in cxl_parse_cfmws()") [1]
    Cc: <stable@vger.kernel.org>
    Cc: Breno Leitao <leitao@debian.org>
    Cc: Alison Schofield <alison.schofield@intel.com>
    Cc: Vishal Verma <vishal.l.verma@intel.com>
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    5c6224bf
acpi.c 22.2 KB