Skip to contentSkip to conversation

media: c8sectpfe: remove redundant assignment to pointer tsin

PATCH In review Colin Ian King 3 participants 3 messages Dec 5, 2021 – Dec 7, 2021

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

PATCH 1/1 media: c8sectpfe: remove redundant assignment to pointer tsin

Pointer tsin is being assigned a value that is never read. The assignment is redundant and can be removed.

---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +0 -4
index 02dc78bd7fab..e1f520903248 100644
@@ -930,12 +930,8 @@ static int configure_channels(struct c8sectpfei *fei)
 
 	/* iterate round each tsin and configure memdma descriptor and IB hw */
 	for_each_child_of_node(np, child) {
-
-		tsin = fei->channel_data[index];
-
 		ret = configure_memdma_and_inputblock(fei,
 						fei->channel_data[index]);
-
 		if (ret) {
 			dev_err(fei->dev,
 				"configure_memdma_and_inputblock failed\n");
Signature · 1 line
2.33.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Colin

Quoted 16 lines · Colin Ian King

Pointer tsin is being assigned a value that is never read. The assignment is redundant and can be removed.

---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +0 -0
index 02dc78bd7fab..e1f520903248 100644
@@ -930,12 +930,8 @@ static int configure_channels(struct c8sectpfei *fei)
 
 	/* iterate round each tsin and configure memdma descriptor and IB hw */

drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c static int configure_channels(struct c8sectpfei *fei) · line 937

Quoted 10 lines
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +0 -4
 	for_each_child_of_node(np, child) {
-
-		tsin = fei->channel_data[index];
-
 		ret = configure_memdma_and_inputblock(fei,
 						fei->channel_data[index]);
-
 		if (ret) {
 			dev_err(fei->dev,
 				"configure_memdma_and_inputblock failed\n");

Thanks
Patrice

#2 lore raw
In reply to Colin Ian King
Quoted 15 lines · Colin Ian King

Pointer tsin is being assigned a value that is never read. The assignment is redundant and can be removed.

---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +0 -0
index 02dc78bd7fab..e1f520903248 100644
@@ -930,12 +930,8 @@ static int configure_channels(struct c8sectpfei *fei)
 
 	/* iterate round each tsin and configure memdma descriptor and IB hw */

drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c static int configure_channels(struct c8sectpfei *fei) · line 937

Quoted 10 lines
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +0 -4
 	for_each_child_of_node(np, child) {
-
-		tsin = fei->channel_data[index];
-
 		ret = configure_memdma_and_inputblock(fei,
 						fei->channel_data[index]);
-
 		if (ret) {
 			dev_err(fei->dev,
 				"configure_memdma_and_inputblock failed\n");

This function is weird. So far as I can see instead of looping for_each_child_of_node() it could just do:

	for (i = 0; i < fei->tsin_count; i++) {

It's equivalent and simpler.

The error handling has a double free as well because configure_memdma_and_inputblock() calls free_input_block() and the goto err_unmap does too. It should be:

	while (--i >= 0)
		free_input_block(fei, fei->channel_data[i]);

I'll send a patch for this tomorrow.

regards,
dan carpenter