Skip to content

drivers: adc: ad405x: fix GPIO leak in ad405x_init error paths#3063

Merged
buha merged 1 commit intomainfrom
staging/bug-5-fix-ad405x-resource-leak
Apr 20, 2026
Merged

drivers: adc: ad405x: fix GPIO leak in ad405x_init error paths#3063
buha merged 1 commit intomainfrom
staging/bug-5-fix-ad405x-resource-leak

Conversation

@amiclaus
Copy link
Copy Markdown
Contributor

@amiclaus amiclaus commented Apr 8, 2026

When ad405x_init_gpios() succeeds but the subsequent SPI/I3C init fails, error_dev only calls no_os_free() without removing the GPIOs. Similarly, error_com only removes the comm interface but not the GPIOs. Add an error_gpio label between them to properly release gpio_gpio0, gpio_gpio1 and gpio_cnv on failure.

Fixes: 0f181cb ("drivers: ad405x: fix GPIO leak in error paths")

Pull Request Description

Please replace this with a detailed description and motivation of the changes.
You can tick the checkboxes below with an 'x' between square brackets or just check them after publishing the PR.
If this PR contains a breaking change, list dependent PRs and try to push all related PRs at the same time.

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • Breaking change (has dependencies in other repos or will cause CI to fail)

PR Checklist

  • I have followed the Coding style guidelines
  • I have complied with the Submission Checklist
  • I have performed a self-review of the changes
  • I have commented my code, at least hard-to-understand parts
  • I have build all projects affected by the changes in this PR
  • I have tested in hardware affected projects, at the relevant boards
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe etc), if applies

When ad405x_init_gpios() succeeds but the subsequent SPI/I3C init
fails, error_dev only calls no_os_free() without removing the GPIOs.
Similarly, error_com only removes the comm interface but not the
GPIOs. Add an error_gpio label between them to properly release
gpio_gpio0, gpio_gpio1 and gpio_cnv on failure.

Fixes: 0f181cb ("drivers: ad405x: fix GPIO leak in error paths")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
@buha buha merged commit 27accac into main Apr 20, 2026
16 of 19 checks passed
@buha buha deleted the staging/bug-5-fix-ad405x-resource-leak branch April 20, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants