]> git.itanic.dy.fi Git - linux-stable/commitdiff
cxl/hdm: Fix && vs || bug
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 31 Oct 2023 09:53:52 +0000 (12:53 +0300)
committerDan Williams <dan.j.williams@intel.com>
Tue, 31 Oct 2023 21:09:50 +0000 (14:09 -0700)
If "info" is NULL then this code will crash.  || was intended instead of
&&.

Fixes: 8ce520fdea24 ("cxl/hdm: Use stored Component Register mappings to map HDM decoder capability")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Robert Richter <rrichter@amd.com>
Link: https://lore.kernel.org/r/60028378-d3d5-4d6d-90fd-f915f061e731@moroto.mountain
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/hdm.c

index bc8ad4a8afca2349c75f67d4d235b4d5827a20a0..af17da8230d56e15cdd01e51efb5069fdf8a2bee 100644 (file)
@@ -146,7 +146,7 @@ struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
 
        /* Memory devices can configure device HDM using DVSEC range regs. */
        if (reg_map->resource == CXL_RESOURCE_NONE) {
-               if (!info && !info->mem_enabled) {
+               if (!info || !info->mem_enabled) {
                        dev_err(dev, "No component registers mapped\n");
                        return ERR_PTR(-ENXIO);
                }