[PATCH 05/20] pinctrl/rockchip: of_populate_platform for gpio only for of node

From: Jianqun Xu
Date: Tue Sep 20 2022 - 06:31:48 EST


As the of_populate_platform named with prefix "of_", it should be done
only when the of node is exist.

Signed-off-by: Jianqun Xu <jay.xu@xxxxxxxxxxxxxx>
---
drivers/pinctrl/pinctrl-rockchip.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 8f102f327af8..42aa3552417a 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3296,12 +3296,11 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
void __iomem *base;
int ret;

- if (!is_of_node(fwnode))
- return dev_err_probe(dev, -ENODEV, "device tree node not found\n");
-
- ret = of_platform_populate(np, NULL, NULL, dev);
- if (ret)
- return dev_err_probe(dev, ret, "failed to register gpio device\n");
+ if (is_of_node(fwnode)) {
+ ret = of_platform_populate(np, NULL, NULL, dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register gpio device\n");
+ }

info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
if (!info)
--
2.25.1