Commit 6fbd92a8 authored by Linus Walleij's avatar Linus Walleij

Merge tag 'samsung-pinctrl-5.5' of...

Merge tag 'samsung-pinctrl-5.5' of https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung into devel

Samsung pinctrl drivers changes for v5.5

Fix several device node refcnt leaks (missing of_node_put()) in several
drivers.
parents 4b024225 a322b337
...@@ -486,8 +486,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) ...@@ -486,8 +486,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
if (match) { if (match) {
irq_chip = kmemdup(match->data, irq_chip = kmemdup(match->data,
sizeof(*irq_chip), GFP_KERNEL); sizeof(*irq_chip), GFP_KERNEL);
if (!irq_chip) if (!irq_chip) {
of_node_put(np);
return -ENOMEM; return -ENOMEM;
}
wkup_np = np; wkup_np = np;
break; break;
} }
...@@ -504,6 +506,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) ...@@ -504,6 +506,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
bank->nr_pins, &exynos_eint_irqd_ops, bank); bank->nr_pins, &exynos_eint_irqd_ops, bank);
if (!bank->irq_domain) { if (!bank->irq_domain) {
dev_err(dev, "wkup irq domain add failed\n"); dev_err(dev, "wkup irq domain add failed\n");
of_node_put(wkup_np);
return -ENXIO; return -ENXIO;
} }
...@@ -518,8 +521,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) ...@@ -518,8 +521,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
weint_data = devm_kcalloc(dev, weint_data = devm_kcalloc(dev,
bank->nr_pins, sizeof(*weint_data), bank->nr_pins, sizeof(*weint_data),
GFP_KERNEL); GFP_KERNEL);
if (!weint_data) if (!weint_data) {
of_node_put(wkup_np);
return -ENOMEM; return -ENOMEM;
}
for (idx = 0; idx < bank->nr_pins; ++idx) { for (idx = 0; idx < bank->nr_pins; ++idx) {
irq = irq_of_parse_and_map(bank->of_node, idx); irq = irq_of_parse_and_map(bank->of_node, idx);
...@@ -536,10 +541,13 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) ...@@ -536,10 +541,13 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
} }
} }
if (!muxed_banks) if (!muxed_banks) {
of_node_put(wkup_np);
return 0; return 0;
}
irq = irq_of_parse_and_map(wkup_np, 0); irq = irq_of_parse_and_map(wkup_np, 0);
of_node_put(wkup_np);
if (!irq) { if (!irq) {
dev_err(dev, "irq number for muxed EINTs not found\n"); dev_err(dev, "irq number for muxed EINTs not found\n");
return 0; return 0;
......
...@@ -490,8 +490,10 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d) ...@@ -490,8 +490,10 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d)
return -ENODEV; return -ENODEV;
eint_data = devm_kzalloc(dev, sizeof(*eint_data), GFP_KERNEL); eint_data = devm_kzalloc(dev, sizeof(*eint_data), GFP_KERNEL);
if (!eint_data) if (!eint_data) {
of_node_put(eint_np);
return -ENOMEM; return -ENOMEM;
}
eint_data->drvdata = d; eint_data->drvdata = d;
...@@ -503,12 +505,14 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d) ...@@ -503,12 +505,14 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d)
irq = irq_of_parse_and_map(eint_np, i); irq = irq_of_parse_and_map(eint_np, i);
if (!irq) { if (!irq) {
dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i); dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i);
of_node_put(eint_np);
return -ENXIO; return -ENXIO;
} }
eint_data->parents[i] = irq; eint_data->parents[i] = irq;
irq_set_chained_handler_and_data(irq, handlers[i], eint_data); irq_set_chained_handler_and_data(irq, handlers[i], eint_data);
} }
of_node_put(eint_np);
bank = d->pin_banks; bank = d->pin_banks;
for (i = 0; i < d->nr_banks; ++i, ++bank) { for (i = 0; i < d->nr_banks; ++i, ++bank) {
......
...@@ -704,8 +704,10 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) ...@@ -704,8 +704,10 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)
return -ENODEV; return -ENODEV;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data) {
of_node_put(eint0_np);
return -ENOMEM; return -ENOMEM;
}
data->drvdata = d; data->drvdata = d;
for (i = 0; i < NUM_EINT0_IRQ; ++i) { for (i = 0; i < NUM_EINT0_IRQ; ++i) {
...@@ -714,6 +716,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) ...@@ -714,6 +716,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)
irq = irq_of_parse_and_map(eint0_np, i); irq = irq_of_parse_and_map(eint0_np, i);
if (!irq) { if (!irq) {
dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i); dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i);
of_node_put(eint0_np);
return -ENXIO; return -ENXIO;
} }
...@@ -721,6 +724,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) ...@@ -721,6 +724,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)
s3c64xx_eint0_handlers[i], s3c64xx_eint0_handlers[i],
data); data);
} }
of_node_put(eint0_np);
bank = d->pin_banks; bank = d->pin_banks;
for (i = 0; i < d->nr_banks; ++i, ++bank) { for (i = 0; i < d->nr_banks; ++i, ++bank) {
......
...@@ -272,6 +272,7 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -272,6 +272,7 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev,
&reserved_maps, num_maps); &reserved_maps, num_maps);
if (ret < 0) { if (ret < 0) {
samsung_dt_free_map(pctldev, *map, *num_maps); samsung_dt_free_map(pctldev, *map, *num_maps);
of_node_put(np);
return ret; return ret;
} }
} }
...@@ -785,8 +786,10 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( ...@@ -785,8 +786,10 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions(
if (!of_get_child_count(cfg_np)) { if (!of_get_child_count(cfg_np)) {
ret = samsung_pinctrl_create_function(dev, drvdata, ret = samsung_pinctrl_create_function(dev, drvdata,
cfg_np, func); cfg_np, func);
if (ret < 0) if (ret < 0) {
of_node_put(cfg_np);
return ERR_PTR(ret); return ERR_PTR(ret);
}
if (ret > 0) { if (ret > 0) {
++func; ++func;
++func_cnt; ++func_cnt;
...@@ -797,8 +800,11 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( ...@@ -797,8 +800,11 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions(
for_each_child_of_node(cfg_np, func_np) { for_each_child_of_node(cfg_np, func_np) {
ret = samsung_pinctrl_create_function(dev, drvdata, ret = samsung_pinctrl_create_function(dev, drvdata,
func_np, func); func_np, func);
if (ret < 0) if (ret < 0) {
of_node_put(func_np);
of_node_put(cfg_np);
return ERR_PTR(ret); return ERR_PTR(ret);
}
if (ret > 0) { if (ret > 0) {
++func; ++func;
++func_cnt; ++func_cnt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment