Commit ae1cf47
pinctrl: core: fix possible memory leak when pinctrl_enable() fails
In devm_pinctrl_register(), if pinctrl_enable() fails in pinctrl_register(),
the "pctldev" has not been added to dev resources, so devm_pinctrl_dev_release()
can not be called, it leads memory leak.
Introduce pinctrl_uninit_controller(), call it in the error path to free memory.
Fixes: 5038a66 ("pinctrl: core: delete incorrect free in pinctrl_enable()")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20240606023704.3931561-2-yangyingliang@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>1 parent 1583dc1 commit ae1cf47
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2090 | 2090 | | |
2091 | 2091 | | |
2092 | 2092 | | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
2093 | 2101 | | |
2094 | 2102 | | |
2095 | 2103 | | |
| |||
2170 | 2178 | | |
2171 | 2179 | | |
2172 | 2180 | | |
2173 | | - | |
| 2181 | + | |
| 2182 | + | |
2174 | 2183 | | |
| 2184 | + | |
2175 | 2185 | | |
2176 | 2186 | | |
2177 | 2187 | | |
| |||
0 commit comments