Skip to contentSkip to conversation

resources: Remove unneeded initialization of local variable

PATCH In review Bojan Prtvar 2 participants 3 messages Dec 29, 2015 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 resources: Remove unneeded initialization of local variable

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()

---
 kernel/resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/resource.c +1 -1
index f150dbb..1e48ede 100644
@@ -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),
Signature · 1 line
2.4.1
#1 lore raw

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 <[email protected]>:

Quoted 32 lines

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()

---
 kernel/resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/resource.c +1 -1
index f150dbb..1e48ede 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
« 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 »