Skip to contentSkip to conversation

ASoC: ti: davinci-mcasp: remove redundant assignment to variable ret

PATCH Superseded Colin King 2 participants 2 messages Feb 8, 2020 – Feb 10, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ASoC: ti: davinci-mcasp: remove redundant assignment to variable ret

From: Colin Ian King <[email protected]>

The assignment to ret is redundant as it is not used in the error return path and hence can be removed.

Addresses-Coverity: ("Unused value")

---
 sound/soc/ti/davinci-mcasp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/ti/davinci-mcasp.c +1 -3
index e1e937eb1dc1..450c394b2882 100644
@@ -1764,10 +1764,8 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of(
 	} else if (match) {
 		pdata = devm_kmemdup(&pdev->dev, match->data, sizeof(*pdata),
 				     GFP_KERNEL);
-		if (!pdata) {
-			ret = -ENOMEM;
+		if (!pdata)
 			return pdata;
-		}
 	} else {
 		/* control shouldn't reach here. something is wrong */
 		ret = -EINVAL;
Signature · 1 line
2.25.0
#1 lore raw
Quoted 16 lines · Colin King

From: Colin Ian King <[email protected]>

The assignment to ret is redundant as it is not used in the error return path and hence can be removed.

Addresses-Coverity: ("Unused value")

---
 sound/soc/ti/davinci-mcasp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/ti/davinci-mcasp.c +0 -0
index e1e937eb1dc1..450c394b2882 100644

sound/soc/ti/davinci-mcasp.c static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of( · line 1768

Quoted 7 lines
sound/soc/ti/davinci-mcasp.c +1 -2
@@ -1764,10 +1764,8 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of(
 	} else if (match) {
 		pdata = devm_kmemdup(&pdev->dev, match->data, sizeof(*pdata),
 				     GFP_KERNEL);
-		if (!pdata) {
-			ret = -ENOMEM;
+		if (!pdata)
 			return pdata;

Use a literal NULL for readability. "return NULL;".

regards,
dan carpenter