Commit d10eba8
committed
drivers: spi: ambiq_spid: fix runtime PM leaks and return status
In spi_ambiq_transceive(), three issues affected the runtime PM path
and error reporting:
1. When spi_config() failed, the function returned directly without
releasing the runtime PM reference acquired by pm_device_runtime_get(),
causing the usage count to permanently leak.
2. The return status of spi_ambiq_xfer() was overwritten by the return
value of pm_device_runtime_put_async(), masking transfer errors from
callers.
3. When pm_device_runtime_get() failed, execution continued into the
hardware routine instead of exiting early.
Restructure spi_ambiq_transceive() to return immediately on get
failures, route spi_config() errors through a shared cleanup label, and
use a separate variable for the async put return value.
Fixes #116324
Signed-off-by: harshit kudhial <harshitkudhial@gmail.com>1 parent e64f6be commit d10eba8
1 file changed
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
| |||
285 | 286 | | |
286 | 287 | | |
287 | 288 | | |
| 289 | + | |
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
295 | | - | |
296 | | - | |
| 297 | + | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
| 304 | + | |
303 | 305 | | |
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
307 | 309 | | |
308 | | - | |
309 | | - | |
310 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
| |||
0 commit comments