Commit bffdf9d
committed
Input: edt-ft5x06 - fix regmap leak when probe fails
The driver neglects to free the instance of I2C regmap constructed at
the beginning of the edt_ft5x06_ts_probe() method when probe fails.
Additionally edt_ft5x06_ts_remove() is freeing the regmap too early,
before the rest of the device resources that are managed by devm are
released.
Fix this by installing a custom devm action that will ensure that the
regmap is released at the right time during normal teardown as well as
in case of probe failure.
Note that devm_regmap_init_i2c() could not be used because the driver
may replace the original regmap with a regmap specific for M06 devices
in the middle of the probe, and using devm_regmap_init_i2c() would
result in releasing the M06 regmap too early.
Reported-by: Li Zetao <[email protected]>
Fixes: 9dfd970 ("Input: edt-ft5x06 - convert to use regmap API")
Cc: [email protected]
Reviewed-by: Oliver Graute <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>1 parent 2de01e0 commit bffdf9d
1 file changed
+18
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1121 | 1121 | | |
1122 | 1122 | | |
1123 | 1123 | | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1124 | 1132 | | |
1125 | 1133 | | |
1126 | 1134 | | |
| |||
1154 | 1162 | | |
1155 | 1163 | | |
1156 | 1164 | | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1157 | 1175 | | |
1158 | 1176 | | |
1159 | 1177 | | |
| |||
1347 | 1365 | | |
1348 | 1366 | | |
1349 | 1367 | | |
1350 | | - | |
1351 | 1368 | | |
1352 | 1369 | | |
1353 | 1370 | | |
| |||
0 commit comments