]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
firmware: arm_scmi: replace of_match_device->data with of_device_get_match_data()
authorAditya Pakki <pakki001@umn.edu>
Fri, 22 Mar 2019 21:55:03 +0000 (16:55 -0500)
committerSudeep Holla <sudeep.holla@arm.com>
Fri, 12 Apr 2019 17:11:18 +0000 (18:11 +0100)
of_match_device can return NULL if no matching device is found though
it's highly unlikely to happen in scmi_probe as it's called only if
a valid match is found.

However we can use of_device_get_match_data() instead of
of_match_device()->data to handle NULL pointer checks and return -EINVAL
in such a scenario.

Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/driver.c

index dd967d675c08daf5ebafdbe3a2ae48ac1c42d211..b5bc4c7a8fab2957bb0842b95e32d152f11837aa 100644 (file)
@@ -796,7 +796,9 @@ static int scmi_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       desc = of_match_device(scmi_of_match, dev)->data;
+       desc = of_device_get_match_data(dev);
+       if (!desc)
+               return -EINVAL;
 
        info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
        if (!info)