Jelajahi Sumber

PCI: exynos: Fix a potential init_clk_resources NULL pointer dereference

In order to avoid triggering a NULL pointer dereference in
exynos_pcie_probe() a check must be put in place to detect if
the init_clk_resources hook is initialized before calling it.

Add the respective function pointer check in exynos_pcie_probe().

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
[lorenzo.pieralisi@arm.com: rewrote the commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Jaehoon Chung 7 tahun lalu
induk
melakukan
b5d6bc90c9
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      drivers/pci/dwc/pci-exynos.c

+ 2 - 1
drivers/pci/dwc/pci-exynos.c

@@ -499,7 +499,8 @@ static int __init exynos_pcie_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	if (ep->ops && ep->ops->get_clk_resources) {
+	if (ep->ops && ep->ops->get_clk_resources &&
+			ep->ops->init_clk_resources) {
 		ret = ep->ops->get_clk_resources(ep);
 		if (ret)
 			return ret;