Message ID | 20230505113856.463650-4-s.hauer@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add perf support to the rockchip-dfi driver | expand |
On Fri, 5 May 2023 13:38:38 +0200 Sascha Hauer <s.hauer@pengutronix.de> wrote: > As a matter of fact the regmap_pmu already is mandatory because > it is used unconditionally in the driver. Bail out gracefully in > probe() rather than crashing later. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Agreed on it uses it unconditionally currently - this is a fix, so maybe a fixes tag? > --- > drivers/devfreq/event/rockchip-dfi.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c > index 98712ac68aa5f..47cc9e48dafab 100644 > --- a/drivers/devfreq/event/rockchip-dfi.c > +++ b/drivers/devfreq/event/rockchip-dfi.c > @@ -193,14 +193,14 @@ static int rockchip_dfi_probe(struct platform_device *pdev) > return dev_err_probe(dev, PTR_ERR(dfi->clk), > "Cannot get the clk pclk_ddr_mon\n"); > > - /* try to find the optional reference to the pmu syscon */ > node = of_parse_phandle(np, "rockchip,pmu", 0); > - if (node) { > - dfi->regmap_pmu = syscon_node_to_regmap(node); > - of_node_put(node); > - if (IS_ERR(dfi->regmap_pmu)) > - return PTR_ERR(dfi->regmap_pmu); > - } > + if (!node) > + return dev_err_probe(&pdev->dev, -ENODEV, "Can't find pmu_grf registers\n"); > + > + dfi->regmap_pmu = syscon_node_to_regmap(node); of_node_put(node); needed, or an explanation of why not. > + if (IS_ERR(dfi->regmap_pmu)) > + return PTR_ERR(dfi->regmap_pmu); > + > dfi->dev = dev; > > desc = &dfi->desc;
diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c index 98712ac68aa5f..47cc9e48dafab 100644 --- a/drivers/devfreq/event/rockchip-dfi.c +++ b/drivers/devfreq/event/rockchip-dfi.c @@ -193,14 +193,14 @@ static int rockchip_dfi_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(dfi->clk), "Cannot get the clk pclk_ddr_mon\n"); - /* try to find the optional reference to the pmu syscon */ node = of_parse_phandle(np, "rockchip,pmu", 0); - if (node) { - dfi->regmap_pmu = syscon_node_to_regmap(node); - of_node_put(node); - if (IS_ERR(dfi->regmap_pmu)) - return PTR_ERR(dfi->regmap_pmu); - } + if (!node) + return dev_err_probe(&pdev->dev, -ENODEV, "Can't find pmu_grf registers\n"); + + dfi->regmap_pmu = syscon_node_to_regmap(node); + if (IS_ERR(dfi->regmap_pmu)) + return PTR_ERR(dfi->regmap_pmu); + dfi->dev = dev; desc = &dfi->desc;
As a matter of fact the regmap_pmu already is mandatory because it is used unconditionally in the driver. Bail out gracefully in probe() rather than crashing later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/devfreq/event/rockchip-dfi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)