Skip to contentSkip to conversation

dax: remove redundant assignment to variable rc

PATCH In review Colin Ian King 4 participants 4 messages Apr 15, 2024 – Apr 16, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dax: remove redundant assignment to variable rc

The variable rc is being assigned an value and then is being re-assigned a new value in the next statement. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/dax/bus.c:1207:2: warning: Value stored to 'rc' is never read [deadcode.DeadStores]

---
 drivers/dax/bus.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dax/bus.c +0 -1
index 797e1ebff299..f758afbf8f09 100644
@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
 	if (rc)
 		return rc;
 
-	rc = -ENXIO;
 	rc = down_write_killable(&dax_region_rwsem);
 	if (rc)
 		return rc;
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Colin Ian King

The variable rc is being assigned an value and then is being re-assigned a new value in the next statement. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/dax/bus.c:1207:2: warning: Value stored to 'rc' is never read [deadcode.DeadStores]

Quoted 20 lines
---
 drivers/dax/bus.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dax/bus.c +0 -1
index 797e1ebff299..f758afbf8f09 100644
@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
 	if (rc)
 		return rc;
 
-	rc = -ENXIO;
 	rc = down_write_killable(&dax_region_rwsem);
 	if (rc)
 		return rc;
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Colin Ian King
Quoted 9 lines · Colin Ian King

The variable rc is being assigned an value and then is being re-assigned a new value in the next statement. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/dax/bus.c:1207:2: warning: Value stored to 'rc' is never read [deadcode.DeadStores]

Quoted 16 lines
---
 drivers/dax/bus.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dax/bus.c +0 -1
index 797e1ebff299..f758afbf8f09 100644
@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
 	if (rc)
 		return rc;
 
-	rc = -ENXIO;
 	rc = down_write_killable(&dax_region_rwsem);
 	if (rc)
 		return rc;
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Colin Ian King
Quoted 9 lines · Colin Ian King

The variable rc is being assigned an value and then is being re-assigned a new value in the next statement. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/dax/bus.c:1207:2: warning: Value stored to 'rc' is never read [deadcode.DeadStores]

Quoted 16 lines

---
 drivers/dax/bus.c | 1 -

 1 file changed, 1 deletion(-)
drivers/dax/bus.c +0 -0
index 797e1ebff299..f758afbf8f09 100644
@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
  	if (rc)
  		return rc;

drivers/dax/bus.c +0 -1
-	rc = -ENXIO;

  rc = down_write_killable(&dax_region_rwsem); if (rc)
  return rc;