mfd: qcom_rpm: Fix a possible NULL dereference
authorLABBE Corentin <[email protected]>
Thu, 12 Nov 2015 07:49:59 +0000 (08:49 +0100)
committerLee Jones <[email protected]>
Fri, 4 Dec 2015 08:46:23 +0000 (08:46 +0000)
of_match_device could return NULL, and so cause a NULL pointer
dereference later.

Signed-off-by: LABBE Corentin <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
drivers/mfd/qcom_rpm.c

index 207a3bd6855979c9f3299b834889870bbb249b34..1be47ad6441bfa879a3efadbf8fada0d38b673ef 100644 (file)
@@ -495,6 +495,8 @@ static int qcom_rpm_probe(struct platform_device *pdev)
        }
 
        match = of_match_device(qcom_rpm_of_match, &pdev->dev);
+       if (!match)
+               return -ENODEV;
        rpm->data = match->data;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);