[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3dc54cf1-4f2c-f853-ac1a-5434440112a4@suse.de>
Date: Thu, 9 Aug 2018 21:18:02 +0200
From: Andreas Färber <afaerber@...e.de>
To: Ben Whitten <ben.whitten@...il.com>
Cc: starnight@...cu.edu.tw, hasnain.virk@....com,
netdev@...r.kernel.org, liuxuenetmail@...il.com, shess@...sware.de,
Ben Whitten <ben.whitten@...rdtech.com>
Subject: Re: [PATCH lora-next v2 1/8] net: lora: add methods for devm
registration
Am 09.08.2018 um 14:33 schrieb Ben Whitten:
> Follow the devm model so that we can avoid lengthy unwind code.
>
> Signed-off-by: Ben Whitten <ben.whitten@...rdtech.com>
> ---
> drivers/net/lora/dev.c | 28 ++++++++++++++++++++++++++++
> include/linux/lora/dev.h | 1 +
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/net/lora/dev.c b/drivers/net/lora/dev.c
> index 8c01106..e32a870 100644
> --- a/drivers/net/lora/dev.c
> +++ b/drivers/net/lora/dev.c
> @@ -84,6 +84,34 @@ void free_loradev(struct net_device *dev)
> }
> EXPORT_SYMBOL_GPL(free_loradev);
>
> +static void devm_free_loradev(struct device *dev, void *res)
> +{
> + struct net_device *net = (*(struct net_device **)res);
> + free_loradev(net);
This is what I meant with adding a variable:
diff --git a/drivers/net/lora/dev.c b/drivers/net/lora/dev.c
index c1b196cdf835..0d4823de8c06 100644
--- a/drivers/net/lora/dev.c
+++ b/drivers/net/lora/dev.c
@@ -87,8 +87,9 @@ EXPORT_SYMBOL_GPL(free_loradev);
static void devm_free_loradev(struct device *dev, void *res)
{
- struct net_device *net = (*(struct net_device **)res);
- free_loradev(net);
+ struct net_device **net = res;
+
+ free_loradev(*net);
}
struct net_device *devm_alloc_loradev(struct device *dev, size_t priv)
Applying.
Thanks,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Powered by blists - more mailing lists