2024-04-15 10:19:44

by Colin Ian King

[permalink] [raw]
Subject: [PATCH][next] 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]

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/dax/bus.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 797e1ebff299..f758afbf8f09 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -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;
--
2.39.2



2024-04-15 16:38:16

by Alison Schofield

[permalink] [raw]
Subject: Re: [PATCH][next] dax: remove redundant assignment to variable rc

On Mon, Apr 15, 2024 at 11:19:28AM +0100, Colin Ian King wrote:
> 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]
>
> Signed-off-by: Colin Ian King <[email protected]>

Reviewed-by: Alison Schofield <[email protected]>

> ---
> drivers/dax/bus.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index 797e1ebff299..f758afbf8f09 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -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;
> --
> 2.39.2
>
>

2024-04-15 17:56:09

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH][next] dax: remove redundant assignment to variable rc



On 4/15/24 3:19 AM, Colin Ian King wrote:
> 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]
>
> Signed-off-by: Colin Ian King <[email protected]>

Reviewed-by: Dave Jiang <[email protected]>
> ---
> drivers/dax/bus.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index 797e1ebff299..f758afbf8f09 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -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;

2024-04-16 23:04:06

by Vishal Verma

[permalink] [raw]
Subject: Re: [PATCH][next] dax: remove redundant assignment to variable rc

On Mon, 2024-04-15 at 11:19 +0100, Colin Ian King wrote:
> 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]
>
> Signed-off-by: Colin Ian King <[email protected]>

Reviewed-by: Vishal Verma <[email protected]>

> ---
>  drivers/dax/bus.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index 797e1ebff299..f758afbf8f09 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -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;