diff mbox series

ASoC: SOF: imx8: Fix an is IS_ERR() vs NULL check

Message ID 20190826131855.GA6840@mwanda (mailing list archive)
State Accepted
Commit a325c7bc3a92f1d5ba8cff10d7ab93a989cdeb80
Headers show
Series ASoC: SOF: imx8: Fix an is IS_ERR() vs NULL check | expand

Commit Message

Dan Carpenter Aug. 26, 2019, 1:18 p.m. UTC
The device_link_add() function only returns NULL on error, it doesn't
return error pointers.

Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 sound/soc/sof/imx/imx8.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Baluta Aug. 26, 2019, 1:23 p.m. UTC | #1
On Mon, 2019-08-26 at 16:18 +0300, Dan Carpenter wrote:
> The device_link_add() function only returns NULL on error, it doesn't
> return error pointers.
> 
> Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks Dan! Nice catch.

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

> ---
>  sound/soc/sof/imx/imx8.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
> index e502f584207f..41ad3a310808 100644
> --- a/sound/soc/sof/imx/imx8.c
> +++ b/sound/soc/sof/imx/imx8.c
> @@ -227,8 +227,8 @@ static int imx8_probe(struct snd_sof_dev *sdev)
>  						DL_FLAG_STATELESS |
>  						DL_FLAG_PM_RUNTIME |
>  						DL_FLAG_RPM_ACTIVE);
> -		if (IS_ERR(priv->link[i])) {
> -			ret = PTR_ERR(priv->link[i]);
> +		if (!priv->link[i]) {
> +			ret = -ENOMEM;
>  			dev_pm_domain_detach(priv->pd_dev[i], false);
>  			goto exit_unroll_pm;
>  		}
diff mbox series

Patch

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index e502f584207f..41ad3a310808 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -227,8 +227,8 @@  static int imx8_probe(struct snd_sof_dev *sdev)
 						DL_FLAG_STATELESS |
 						DL_FLAG_PM_RUNTIME |
 						DL_FLAG_RPM_ACTIVE);
-		if (IS_ERR(priv->link[i])) {
-			ret = PTR_ERR(priv->link[i]);
+		if (!priv->link[i]) {
+			ret = -ENOMEM;
 			dev_pm_domain_detach(priv->pd_dev[i], false);
 			goto exit_unroll_pm;
 		}