Samsung pinctrl drivers changes for v5.5

Fix several device node refcnt leaks (missing of_node_put()) in several
 drivers.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAl3AX9cQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD191pD/495M3XdeCJ0y4TQ3WF+bculyh6+wnDEBr6
 GQbRBn8LyOUjpUDhPHZQNp7KPSTcqlA9MqJfr1YAmNsbCZgDQf6rqYKvau6cZ/C4
 fY7yPTHhGKi0Lx2X2RidaVw6xze+rKNFhCTGuyfVE8+EOsgTVuWVHUnX+GXL2JLz
 VddVOciqkYb7gxxP8yxyLZD0eQ8BZF3+aOSUtZHMmjm9dcSssOEeyXgpakw3YiHu
 Qh/BXraPlsGRS0NyNbiis5FdS74qOXC1HXYEo1SXJ/4NkSlSBUQmjATQm++gEITI
 BkMPwNn8L6u3DrozlPCTghESse4bD8aWtdq20z9X0V4Q+Fsj+fQO5Kc4213egdd6
 Sh2CCb6hYUBR5aJzS/+V5jfFd7ehECHwM/nA3CjBKROaWpHWFEidRes2teMHIElC
 W84BdSQ1XCf6ALm2LYL8yM8OARmugomNtZTspW9PonRx9oBNrWo+B71UiQw4eo7J
 Vhjle1pGAobs4s+tFylzyClUm7iHtpZY5rhLfFZpUQvbC5TeYGC2Z+ycLRnc31LG
 Zir0BtJAIIiREt5/Yth4Pv/tDj0G6tn+dmn4a7mJc7Mb6iuXd3k4efV3y63mjaCx
 R3iRFo0eOSOPm27iXDqR21cbHikmB1nt07X3pzUBJAIKpGdgquUAqElYezwFXMXx
 b4eb/UaiXA==
 =TlqO
 -----END PGP SIGNATURE-----

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.
This commit is contained in:
Linus Walleij 2019-11-05 15:40:53 +01:00
Родитель 4b024225c4 a322b3377f
Коммит 6fbd92a833
4 изменённых файлов: 29 добавлений и 7 удалений

Просмотреть файл

@ -486,8 +486,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
if (match) {
irq_chip = kmemdup(match->data,
sizeof(*irq_chip), GFP_KERNEL);
if (!irq_chip)
if (!irq_chip) {
of_node_put(np);
return -ENOMEM;
}
wkup_np = np;
break;
}
@ -504,6 +506,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
bank->nr_pins, &exynos_eint_irqd_ops, bank);
if (!bank->irq_domain) {
dev_err(dev, "wkup irq domain add failed\n");
of_node_put(wkup_np);
return -ENXIO;
}
@ -518,8 +521,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
weint_data = devm_kcalloc(dev,
bank->nr_pins, sizeof(*weint_data),
GFP_KERNEL);
if (!weint_data)
if (!weint_data) {
of_node_put(wkup_np);
return -ENOMEM;
}
for (idx = 0; idx < bank->nr_pins; ++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)
}
}
if (!muxed_banks)
if (!muxed_banks) {
of_node_put(wkup_np);
return 0;
}
irq = irq_of_parse_and_map(wkup_np, 0);
of_node_put(wkup_np);
if (!irq) {
dev_err(dev, "irq number for muxed EINTs not found\n");
return 0;

Просмотреть файл

@ -490,8 +490,10 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d)
return -ENODEV;
eint_data = devm_kzalloc(dev, sizeof(*eint_data), GFP_KERNEL);
if (!eint_data)
if (!eint_data) {
of_node_put(eint_np);
return -ENOMEM;
}
eint_data->drvdata = 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);
if (!irq) {
dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i);
of_node_put(eint_np);
return -ENXIO;
}
eint_data->parents[i] = irq;
irq_set_chained_handler_and_data(irq, handlers[i], eint_data);
}
of_node_put(eint_np);
bank = d->pin_banks;
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)
return -ENODEV;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
if (!data) {
of_node_put(eint0_np);
return -ENOMEM;
}
data->drvdata = d;
for (i = 0; i < NUM_EINT0_IRQ; ++i) {
@ -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);
if (!irq) {
dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i);
of_node_put(eint0_np);
return -ENXIO;
}
@ -721,6 +724,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)
s3c64xx_eint0_handlers[i],
data);
}
of_node_put(eint0_np);
bank = d->pin_banks;
for (i = 0; i < d->nr_banks; ++i, ++bank) {

Просмотреть файл

@ -272,6 +272,7 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev,
&reserved_maps, num_maps);
if (ret < 0) {
samsung_dt_free_map(pctldev, *map, *num_maps);
of_node_put(np);
return ret;
}
}
@ -785,8 +786,10 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions(
if (!of_get_child_count(cfg_np)) {
ret = samsung_pinctrl_create_function(dev, drvdata,
cfg_np, func);
if (ret < 0)
if (ret < 0) {
of_node_put(cfg_np);
return ERR_PTR(ret);
}
if (ret > 0) {
++func;
++func_cnt;
@ -797,8 +800,11 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions(
for_each_child_of_node(cfg_np, func_np) {
ret = samsung_pinctrl_create_function(dev, drvdata,
func_np, func);
if (ret < 0)
if (ret < 0) {
of_node_put(func_np);
of_node_put(cfg_np);
return ERR_PTR(ret);
}
if (ret > 0) {
++func;
++func_cnt;