Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: acpi: Simplify devm_acpi_dma_controller_register()

Use devm_add_action_or_reset() instead of devres_alloc() and
devres_add(), which works the same. This will simplify the
code. There is no functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20241007150436.2183575-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Andy Shevchenko and committed by
Vinod Koul
c0fecce8 6e3ea062

+4 -11
+4 -11
drivers/dma/acpi-dma.c
··· 236 236 } 237 237 EXPORT_SYMBOL_GPL(acpi_dma_controller_free); 238 238 239 - static void devm_acpi_dma_release(struct device *dev, void *res) 239 + static void devm_acpi_dma_free(void *dev) 240 240 { 241 241 acpi_dma_controller_free(dev); 242 242 } ··· 259 259 (struct acpi_dma_spec *, struct acpi_dma *), 260 260 void *data) 261 261 { 262 - void *res; 263 262 int ret; 264 263 265 - res = devres_alloc(devm_acpi_dma_release, 0, GFP_KERNEL); 266 - if (!res) 267 - return -ENOMEM; 268 - 269 264 ret = acpi_dma_controller_register(dev, acpi_dma_xlate, data); 270 - if (ret) { 271 - devres_free(res); 265 + if (ret) 272 266 return ret; 273 - } 274 - devres_add(dev, res); 275 - return 0; 267 + 268 + return devm_add_action_or_reset(dev, devm_acpi_dma_free, dev); 276 269 } 277 270 EXPORT_SYMBOL_GPL(devm_acpi_dma_controller_register); 278 271