Commit cf1199f792da92dabfd5dfb2bd2211b5d191da45

Authored by LABBE Corentin
Committed by Lee Jones
1 parent bdd5dcf513

mfd: qcom_rpm: Fix a possible NULL dereference

of_match_device could return NULL, and so cause a NULL pointer
dereference later.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

drivers/mfd/qcom_rpm.c
... ... @@ -495,6 +495,8 @@
495 495 }
496 496  
497 497 match = of_match_device(qcom_rpm_of_match, &pdev->dev);
  498 + if (!match)
  499 + return -ENODEV;
498 500 rpm->data = match->data;
499 501  
500 502 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);