Remove unnecessary variable assignment in the function
agp_generic_create_gatt_table(). This fixes the clang scan warnings:
warning: Value stored to 'page_order' is never read [deadcode.DeadStores]
page_order = num_entries = 0;
warning: Although the value stored to 'num_entries' is used in the
enclosing expression, the value is never actually read from 'num_entries'
[deadcode.DeadStores]
Signed-off-by: Gautam Menghani <[email protected]>
---
drivers/char/agp/generic.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 3ffbb1c80c5c..046ef61132f6 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -864,7 +864,6 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
table = NULL;
i = bridge->aperture_size_idx;
temp = bridge->current_size;
- page_order = num_entries = 0;
if (bridge->driver->size_type != FIXED_APER_SIZE) {
do {
--
2.34.1
On 6/16/22 12:19 PM, Gautam Menghani wrote:
> Remove unnecessary variable assignment in the function
> agp_generic_create_gatt_table(). This fixes the clang scan warnings:
>
> warning: Value stored to 'page_order' is never read [deadcode.DeadStores]
> page_order = num_entries = 0;
>
> warning: Although the value stored to 'num_entries' is used in the
> enclosing expression, the value is never actually read from 'num_entries'
> [deadcode.DeadStores]
>
> Signed-off-by: Gautam Menghani <[email protected]>
> ---
> drivers/char/agp/generic.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
> index 3ffbb1c80c5c..046ef61132f6 100644
> --- a/drivers/char/agp/generic.c
> +++ b/drivers/char/agp/generic.c
> @@ -864,7 +864,6 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
> table = NULL;
> i = bridge->aperture_size_idx;
> temp = bridge->current_size;
> - page_order = num_entries = 0;
It would be safe to initialize page_order and num_entries when
they are declared a few lines above.
>
> if (bridge->driver->size_type != FIXED_APER_SIZE) {
> do {
>
thanks,
-- Shuah
Remove unnecessary variable assignments in the function
agp_generic_create_gatt_table(). This fixes the clang scan warnings:
warning: Value stored to 'page_order' is never read [deadcode.DeadStores]
page_order = num_entries = 0;
warning: Although the value stored to 'num_entries' is used in the
enclosing expression, the value is never actually read from 'num_entries'
[deadcode.DeadStores]
Signed-off-by: Gautam Menghani <[email protected]>
---
changes in v2:
1. Initialize the variables where they are declared.
drivers/char/agp/generic.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 3ffbb1c80c5c..7fe72c07647d 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -851,8 +851,8 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
{
char *table;
char *table_end;
- int page_order;
- int num_entries;
+ int page_order = 0;
+ int num_entries = 0;
int i;
void *temp;
struct page *page;
@@ -864,7 +864,6 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
table = NULL;
i = bridge->aperture_size_idx;
temp = bridge->current_size;
- page_order = num_entries = 0;
if (bridge->driver->size_type != FIXED_APER_SIZE) {
do {
--
2.34.1