Commit 79c4a56
mtd: call external _get and _put in right order
MTD provider provides mtd_info object to mtd subsystem.
With kref patch the mtd_info object can be alive after
provider released mtd device.
Fix calling order in _get and _put functions to allow
mtd provider to safely alloc and release mtd object.
Execute:
1) call external _get
2) get_module
3) add internal kref
in the get function and opposite order in the put one.
The _put_device callback should be the last in put
as the master struct memory may be freed in this callback.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230620131905.648089-3-alexander.usyskin@intel.com1 parent 19bfa9e commit 79c4a56
1 file changed
Lines changed: 14 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1229 | 1229 | | |
1230 | 1230 | | |
1231 | 1231 | | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | 1232 | | |
1238 | 1233 | | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
| 1234 | + | |
1243 | 1235 | | |
1244 | | - | |
1245 | 1236 | | |
1246 | 1237 | | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1247 | 1246 | | |
1248 | 1247 | | |
1249 | 1248 | | |
| |||
1340 | 1339 | | |
1341 | 1340 | | |
1342 | 1341 | | |
1343 | | - | |
1344 | | - | |
| 1342 | + | |
| 1343 | + | |
1345 | 1344 | | |
1346 | 1345 | | |
1347 | 1346 | | |
1348 | | - | |
1349 | | - | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1350 | 1350 | | |
1351 | 1351 | | |
1352 | 1352 | | |
| |||
0 commit comments