2020-02-08 22:07:57

by Colin King

[permalink] [raw]
Subject: [PATCH] ASoC: Intel: mrfld: return error codes when an error occurs

From: Colin Ian King <[email protected]>

Currently function sst_platform_get_resources always returns zero and
error return codes set by the function are never returned. Fix this
by returning the error return code in variable ret rather than the
hard coded zero.

Addresses-Coverity: ("Unused value")
Fixes: f533a035e4da ("ASoC: Intel: mrfld - create separate module for pci part")
Signed-off-by: Colin Ian King <[email protected]>
---
sound/soc/intel/atom/sst/sst_pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c
index d952719bc098..5862fe968083 100644
--- a/sound/soc/intel/atom/sst/sst_pci.c
+++ b/sound/soc/intel/atom/sst/sst_pci.c
@@ -99,7 +99,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
dev_dbg(ctx->dev, "DRAM Ptr %p\n", ctx->dram);
do_release_regions:
pci_release_regions(pci);
- return 0;
+ return ret;
}

/*
--
2.25.0


2020-02-09 15:35:34

by Cezary Rojewski

[permalink] [raw]
Subject: Re: [PATCH] ASoC: Intel: mrfld: return error codes when an error occurs

On 2020-02-08 23:07, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> Currently function sst_platform_get_resources always returns zero and
> error return codes set by the function are never returned. Fix this
> by returning the error return code in variable ret rather than the
> hard coded zero.
>
> Addresses-Coverity: ("Unused value")
> Fixes: f533a035e4da ("ASoC: Intel: mrfld - create separate module for pci part")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> sound/soc/intel/atom/sst/sst_pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c
> index d952719bc098..5862fe968083 100644
> --- a/sound/soc/intel/atom/sst/sst_pci.c
> +++ b/sound/soc/intel/atom/sst/sst_pci.c
> @@ -99,7 +99,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
> dev_dbg(ctx->dev, "DRAM Ptr %p\n", ctx->dram);
> do_release_regions:
> pci_release_regions(pci);
> - return 0;
> + return ret;
> }
>
> /*
>

Thank you for the fix.

Acked-by: Cezary Rojewski <[email protected]>

2020-02-10 08:52:24

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] ASoC: Intel: mrfld: return error codes when an error occurs

On Sat, Feb 08, 2020 at 10:07:20PM +0000, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> Currently function sst_platform_get_resources always returns zero and
> error return codes set by the function are never returned. Fix this
> by returning the error return code in variable ret rather than the
> hard coded zero.
>
> Addresses-Coverity: ("Unused value")
> Fixes: f533a035e4da ("ASoC: Intel: mrfld - create separate module for pci part")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> sound/soc/intel/atom/sst/sst_pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c
> index d952719bc098..5862fe968083 100644
> --- a/sound/soc/intel/atom/sst/sst_pci.c
> +++ b/sound/soc/intel/atom/sst/sst_pci.c
> @@ -99,7 +99,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
> dev_dbg(ctx->dev, "DRAM Ptr %p\n", ctx->dram);
> do_release_regions:
> pci_release_regions(pci);

It's weird that we release the regions on the success path.

regards,
dan carpenter

> - return 0;
> + return ret;
> }

2020-02-10 14:42:22

by Pierre-Louis Bossart

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: mrfld: return error codes when an error occurs



On 2/8/20 4:07 PM, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> Currently function sst_platform_get_resources always returns zero and
> error return codes set by the function are never returned. Fix this
> by returning the error return code in variable ret rather than the
> hard coded zero.
>
> Addresses-Coverity: ("Unused value")
> Fixes: f533a035e4da ("ASoC: Intel: mrfld - create separate module for pci part")
> Signed-off-by: Colin Ian King <[email protected]>

Yes, it's clearly bad.

Acked-by: Pierre-Louis Bossart <[email protected]>

I don't think this impacts anyone though, the code can only be used for
Merrifield/Tangier.

> ---
> sound/soc/intel/atom/sst/sst_pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c
> index d952719bc098..5862fe968083 100644
> --- a/sound/soc/intel/atom/sst/sst_pci.c
> +++ b/sound/soc/intel/atom/sst/sst_pci.c
> @@ -99,7 +99,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
> dev_dbg(ctx->dev, "DRAM Ptr %p\n", ctx->dram);
> do_release_regions:
> pci_release_regions(pci);
> - return 0;
> + return ret;
> }
>
> /*
>