Skip to content

Commit c0fecce

Browse files
andy-shevvinodkoul
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 6e3ea06 commit c0fecce

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

drivers/dma/acpi-dma.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ int acpi_dma_controller_free(struct device *dev)
236236
}
237237
EXPORT_SYMBOL_GPL(acpi_dma_controller_free);
238238

239-
static void devm_acpi_dma_release(struct device *dev, void *res)
239+
static void devm_acpi_dma_free(void *dev)
240240
{
241241
acpi_dma_controller_free(dev);
242242
}
@@ -259,20 +259,13 @@ int devm_acpi_dma_controller_register(struct device *dev,
259259
(struct acpi_dma_spec *, struct acpi_dma *),
260260
void *data)
261261
{
262-
void *res;
263262
int ret;
264263

265-
res = devres_alloc(devm_acpi_dma_release, 0, GFP_KERNEL);
266-
if (!res)
267-
return -ENOMEM;
268-
269264
ret = acpi_dma_controller_register(dev, acpi_dma_xlate, data);
270-
if (ret) {
271-
devres_free(res);
265+
if (ret)
272266
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);
276269
}
277270
EXPORT_SYMBOL_GPL(devm_acpi_dma_controller_register);
278271

0 commit comments

Comments
 (0)