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

Message ID 20200208215523.36094-1-colin.king@canonical.com
State New
Headers show
Series
  • ASoC: ti: davinci-mcasp: remove redundant assignment to variable ret
Related show

Commit Message

Colin King Feb. 8, 2020, 9:55 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/ti/davinci-mcasp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Dan Carpenter Feb. 10, 2020, 8:35 a.m. UTC | #1
On Sat, Feb 08, 2020 at 09:55:23PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  sound/soc/ti/davinci-mcasp.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
> index e1e937eb1dc1..450c394b2882 100644
> --- a/sound/soc/ti/davinci-mcasp.c
> +++ b/sound/soc/ti/davinci-mcasp.c
> @@ -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

Patch
diff mbox series

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index e1e937eb1dc1..450c394b2882 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -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;