Skip to contentSkip to conversation

cxl/acpi: Introduce cxl_decoder objects

bug report Dan Carpenter 1 participant 1 message Aug 26, 2021

lore
Share & tools
lore
#0 lore raw

Hello Dan Williams,

The patch 40ba17afdfab: "cxl/acpi: Introduce cxl_decoder objects" from Jun 9, 2021, leads to the following
Smatch static checker warning:

	drivers/cxl/core/bus.c:504 devm_cxl_add_decoder()
	warn: 'cxld' isn't an ERR_PTR

drivers/cxl/core/bus.c

    494 int devm_cxl_add_decoder(struct device *host, struct cxl_decoder *cxld,
    495                          int *target_map)
    496 {
    497         struct cxl_port *port = to_cxl_port(cxld->dev.parent);
                                                    ^^^^^^^^^^^^^^^^

Dereference

    498         struct device *dev;
    499         int rc = 0, i;
    500 
    501         if (!cxld)
                    ^^^^^

    502                 return -EINVAL;
    503 
--> 504         if (IS_ERR(cxld))
                    ^^^^^^^^^^^^

These are too late. But fortunately "cxld" is always valid.

    505                 return PTR_ERR(cxld);
    506 
    507         if (cxld->interleave_ways < 1) {
    508                 rc = -EINVAL;
    509                 goto err;
    510         }

regards,
dan carpenter