Commit 8f773bf
pinctrl: single: fix possible memory leak when pinctrl_enable() fails
This driver calls pinctrl_register_and_init() which is not
devm_ managed, it will leads memory leak if pinctrl_enable()
fails. Replace it with devm_pinctrl_register_and_init().
And call pcs_free_resources() if pinctrl_enable() fails.
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-3-yangyingliang@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>1 parent ae1cf47 commit 8f773bf
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1329 | 1329 | | |
1330 | 1330 | | |
1331 | 1331 | | |
1332 | | - | |
1333 | 1332 | | |
1334 | 1333 | | |
1335 | 1334 | | |
| |||
1879 | 1878 | | |
1880 | 1879 | | |
1881 | 1880 | | |
1882 | | - | |
| 1881 | + | |
1883 | 1882 | | |
1884 | 1883 | | |
1885 | 1884 | | |
| |||
1912 | 1911 | | |
1913 | 1912 | | |
1914 | 1913 | | |
1915 | | - | |
| 1914 | + | |
| 1915 | + | |
1916 | 1916 | | |
| 1917 | + | |
1917 | 1918 | | |
1918 | 1919 | | |
1919 | 1920 | | |
| |||
0 commit comments