Re: [PATCH v5 02/17] nvmem: add DEFINE_FREE for nvmem_cell_put cleanup
[email protected] Tue, 04 Aug 2026 11:44:24 +0000
| Newsgroups | org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The `DEFINE_FREE(nvmem_cell_put, ...)` macro is missing from the `CONFIG_NVMEM=n` fallback block, causing compilation failures for drivers using it without NVMEM enabled. -- --- Patch [2]: [PATCH v5 02/17] nvmem: add DEFINE_FREE for nvmem_cell_put cleanup --- commit 2ebca04f3e1ae39d3b1c1039e736c5e4b6555c85 Author: Varshini Rajendran <[email protected]> nvmem: add DEFINE_FREE for nvmem_cell_put cleanup Add cleanup.h helper for nvmem_cell_put() to enable automatic resource cleanup using __free(nvmem_cell_put) annotation. > diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h > index 34c0e58dfa266..35a2ea8b8957b 100644 > --- a/include/linux/nvmem-consumer.h > +++ b/include/linux/nvmem-consumer.h [ ... ] > @@ -54,6 +55,9 @@ struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id); > struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *id); > void nvmem_cell_put(struct nvmem_cell *cell); > void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); > + > +DEFINE_FREE(nvmem_cell_put, struct nvmem_cell *, if (!IS_ERR_OR_NULL(_T)) nvmem_cell_put(_T)) > + [Severity: Low] Will this cause compilation failures for drivers using the cleanup when CONFIG_NVMEM is disabled? Since this macro is defined exclusively inside the #if IS_ENABLED(CONFIG_NVMEM) block, it appears to be missing from the fallback #else block. Moving it outside the #if / #else blocks would make it universally available and prevent build issues when drivers use __free(nvmem_cell_put) without NVMEM enabled. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=2