clk: meson: Hold reference returned by of_get_parent()
[ Upstream commit89ab396d71
] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes:88e2da8124
("clk: meson: aoclk: refactor common code into dedicated file") Fixes:6682bd4d44
("clk: meson: factorise meson64 peripheral clock controller drivers") Fixes:bb6eddd1d2
("clk: meson: meson8b: use the HHI syscon if available") Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20220628141038.168383-1-windhl@126.com Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Родитель
e900ec4c4f
Коммит
e0001a565c
|
@ -38,6 +38,7 @@ int meson_aoclkc_probe(struct platform_device *pdev)
|
||||||
struct meson_aoclk_reset_controller *rstc;
|
struct meson_aoclk_reset_controller *rstc;
|
||||||
struct meson_aoclk_data *data;
|
struct meson_aoclk_data *data;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
|
struct device_node *np;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
int ret, clkid;
|
int ret, clkid;
|
||||||
|
|
||||||
|
@ -49,7 +50,9 @@ int meson_aoclkc_probe(struct platform_device *pdev)
|
||||||
if (!rstc)
|
if (!rstc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
regmap = syscon_node_to_regmap(of_get_parent(dev->of_node));
|
np = of_get_parent(dev->of_node);
|
||||||
|
regmap = syscon_node_to_regmap(np);
|
||||||
|
of_node_put(np);
|
||||||
if (IS_ERR(regmap)) {
|
if (IS_ERR(regmap)) {
|
||||||
dev_err(dev, "failed to get regmap\n");
|
dev_err(dev, "failed to get regmap\n");
|
||||||
return PTR_ERR(regmap);
|
return PTR_ERR(regmap);
|
||||||
|
|
|
@ -18,6 +18,7 @@ int meson_eeclkc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct meson_eeclkc_data *data;
|
const struct meson_eeclkc_data *data;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
|
struct device_node *np;
|
||||||
struct regmap *map;
|
struct regmap *map;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
|
@ -26,7 +27,9 @@ int meson_eeclkc_probe(struct platform_device *pdev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Get the hhi system controller node */
|
/* Get the hhi system controller node */
|
||||||
map = syscon_node_to_regmap(of_get_parent(dev->of_node));
|
np = of_get_parent(dev->of_node);
|
||||||
|
map = syscon_node_to_regmap(np);
|
||||||
|
of_node_put(np);
|
||||||
if (IS_ERR(map)) {
|
if (IS_ERR(map)) {
|
||||||
dev_err(dev,
|
dev_err(dev,
|
||||||
"failed to get HHI regmap\n");
|
"failed to get HHI regmap\n");
|
||||||
|
|
|
@ -3717,12 +3717,15 @@ static void __init meson8b_clkc_init_common(struct device_node *np,
|
||||||
struct clk_hw_onecell_data *clk_hw_onecell_data)
|
struct clk_hw_onecell_data *clk_hw_onecell_data)
|
||||||
{
|
{
|
||||||
struct meson8b_clk_reset *rstc;
|
struct meson8b_clk_reset *rstc;
|
||||||
|
struct device_node *parent_np;
|
||||||
const char *notifier_clk_name;
|
const char *notifier_clk_name;
|
||||||
struct clk *notifier_clk;
|
struct clk *notifier_clk;
|
||||||
struct regmap *map;
|
struct regmap *map;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
map = syscon_node_to_regmap(of_get_parent(np));
|
parent_np = of_get_parent(np);
|
||||||
|
map = syscon_node_to_regmap(parent_np);
|
||||||
|
of_node_put(parent_np);
|
||||||
if (IS_ERR(map)) {
|
if (IS_ERR(map)) {
|
||||||
pr_err("failed to get HHI regmap - Trying obsolete regs\n");
|
pr_err("failed to get HHI regmap - Trying obsolete regs\n");
|
||||||
return;
|
return;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче