Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298986 > unrolled thread

[PATCH] resources: Remove unneeded initialization of local variable

Started byBojan Prtvar <prtvar.b@gmail.com>
First post2015-12-29 14:30 +0100
Last post2015-12-29 16:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] resources: Remove unneeded initialization of local variable Bojan Prtvar <prtvar.b@gmail.com> - 2015-12-29 14:30 +0100
    Re: [PATCH] resources: Remove unneeded initialization of local variable Laurent Navet <laurent.navet@gmail.com> - 2015-12-29 14:40 +0100
      Re: [PATCH] resources: Remove unneeded initialization of local variable bojan prtvar <prtvar.b@gmail.com> - 2015-12-29 16:10 +0100

#1298986 — [PATCH] resources: Remove unneeded initialization of local variable

FromBojan Prtvar <prtvar.b@gmail.com>
Date2015-12-29 14:30 +0100
Subject[PATCH] resources: Remove unneeded initialization of local variable
Message-ID<qL2vE-13G-1@gated-at.bofh.it>
Few lines below dr is reinitialized by devres_alloc()
so we don't need to init it by NULL in the beginning of
__devm_request_region()

Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
---
 kernel/resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index f150dbb..1e48ede 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1356,7 +1356,7 @@ struct resource * __devm_request_region(struct device *dev,
 				struct resource *parent, resource_size_t start,
 				resource_size_t n, const char *name)
 {
-	struct region_devres *dr = NULL;
+	struct region_devres *dr;
 	struct resource *res;
 
 	dr = devres_alloc(devm_region_release, sizeof(struct region_devres),
-- 
2.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1298991

FromLaurent Navet <laurent.navet@gmail.com>
Date2015-12-29 14:40 +0100
Message-ID<qL2Fk-17h-5@gated-at.bofh.it>
In reply to#1298986
why not directly ?

struct region_devres *dr = devres_alloc(devm_region_release,
sizeof(struct region_devres),..



2015-12-29 14:24 UTC+01:00, Bojan Prtvar <prtvar.b@gmail.com>:
> Few lines below dr is reinitialized by devres_alloc()
> so we don't need to init it by NULL in the beginning of
> __devm_request_region()
>
> Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
> ---
>  kernel/resource.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index f150dbb..1e48ede 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -1356,7 +1356,7 @@ struct resource * __devm_request_region(struct device
> *dev,
>  				struct resource *parent, resource_size_t start,
>  				resource_size_t n, const char *name)
>  {
> -	struct region_devres *dr = NULL;
> +	struct region_devres *dr;
>  	struct resource *res;
>
>  	dr = devres_alloc(devm_region_release, sizeof(struct region_devres),
> --
> 2.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
« On ne résout pas un problème avec les modes de pensée qui l’ont engendré. »
« You cannot solve current problems with current thinking. Current
problems are the result of current thinking »
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299031

Frombojan prtvar <prtvar.b@gmail.com>
Date2015-12-29 16:10 +0100
Message-ID<qL44p-2bo-1@gated-at.bofh.it>
In reply to#1298991
On Tue, Dec 29, 2015 at 2:36 PM, Laurent Navet <laurent.navet@gmail.com> wrote:
> why not directly ?
>
> struct region_devres *dr = devres_alloc(devm_region_release,
> sizeof(struct region_devres),..
>

I follow Dan's rationale [1]

[1]
http://www.spinics.net/lists/target-devel/msg11355.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web