linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] resources: Remove unneeded initialization of local variable
@ 2015-12-29 13:24 Bojan Prtvar
  2015-12-29 13:36 ` Laurent Navet
  0 siblings, 1 reply; 3+ messages in thread
From: Bojan Prtvar @ 2015-12-29 13:24 UTC (permalink / raw)
  To: toshi.kani, dan.j.williams, akpm, jsitnicki, jiang.liu
  Cc: linux-kernel, kernel-janitors, Bojan Prtvar

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] resources: Remove unneeded initialization of local variable
  2015-12-29 13:24 [PATCH] resources: Remove unneeded initialization of local variable Bojan Prtvar
@ 2015-12-29 13:36 ` Laurent Navet
  2015-12-29 15:04   ` bojan prtvar
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Navet @ 2015-12-29 13:36 UTC (permalink / raw)
  To: Bojan Prtvar
  Cc: toshi.kani, dan.j.williams, akpm, jsitnicki, jiang.liu,
	linux-kernel, kernel-janitors

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 »

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] resources: Remove unneeded initialization of local variable
  2015-12-29 13:36 ` Laurent Navet
@ 2015-12-29 15:04   ` bojan prtvar
  0 siblings, 0 replies; 3+ messages in thread
From: bojan prtvar @ 2015-12-29 15:04 UTC (permalink / raw)
  To: Laurent Navet
  Cc: toshi.kani, dan.j.williams, Andrew Morton, Jakub Sitnicki,
	jiang.liu, open list, kernel-janitors

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-29 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29 13:24 [PATCH] resources: Remove unneeded initialization of local variable Bojan Prtvar
2015-12-29 13:36 ` Laurent Navet
2015-12-29 15:04   ` bojan prtvar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).