2020-12-07 01:08:40

by Tian Tao

[permalink] [raw]
Subject: [PATCH] drm/drv: switch to using devm_add_action_or_reset()

switch to using devm_add_action_or_reset() instead of devm_add_action.

Signed-off-by: Tian Tao <[email protected]>
---
drivers/gpu/drm/drm_drv.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7343038..b92f7fd 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -675,11 +675,8 @@ static int devm_drm_dev_init(struct device *parent,
if (ret)
return ret;

- ret = devm_add_action(parent, devm_drm_dev_init_release, dev);
- if (ret)
- devm_drm_dev_init_release(dev);
-
- return ret;
+ return devm_add_action_or_reset(parent,
+ devm_drm_dev_init_release, dev);
}

void *__devm_drm_dev_alloc(struct device *parent,
--
2.7.4


2020-12-08 08:04:33

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH] drm/drv: switch to using devm_add_action_or_reset()



Am 07.12.20 um 02:04 schrieb Tian Tao:
> switch to using devm_add_action_or_reset() instead of devm_add_action.
>
> Signed-off-by: Tian Tao <[email protected]>

I'm surprised that devm_drm_dev_init() didn't already use
devm_add_action_or_reset(). But it doesn't look special, so

Acked-by: Thomas Zimmermann <[email protected]>

> ---
> drivers/gpu/drm/drm_drv.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 7343038..b92f7fd 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -675,11 +675,8 @@ static int devm_drm_dev_init(struct device *parent,
> if (ret)
> return ret;
>
> - ret = devm_add_action(parent, devm_drm_dev_init_release, dev);
> - if (ret)
> - devm_drm_dev_init_release(dev);
> -
> - return ret;
> + return devm_add_action_or_reset(parent,
> + devm_drm_dev_init_release, dev);
> }
>
> void *__devm_drm_dev_alloc(struct device *parent,
>

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature