diff mbox

[11/11] ASoC: qdsp6: q6routing: add proper error check

Message ID 20180625143115.8346-12-srinivas.kandagatla@linaro.org (mailing list archive)
State Accepted
Commit 972562f7aaaa261ec6e1ac14fed0c5bdd0dfb1cb
Headers show

Commit Message

Srinivas Kandagatla June 25, 2018, 2:31 p.m. UTC
q6adm_open can return error pointer or a null in error cases.
Fix this check this.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/qdsp6/q6routing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Niklas Cassel June 25, 2018, 6:04 p.m. UTC | #1
On Mon, Jun 25, 2018 at 03:31:15PM +0100, Srinivas Kandagatla wrote:
> q6adm_open can return error pointer or a null in error cases.
> Fix this check this.

Instead of "Fix this check this.", how about "Fix the return handling."

> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/qdsp6/q6routing.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
> index caf2f847a886..c18f808c7730 100644
> --- a/sound/soc/qcom/qdsp6/q6routing.c
> +++ b/sound/soc/qcom/qdsp6/q6routing.c
> @@ -310,7 +310,7 @@ int q6routing_stream_open(int fedai_id, int perf_mode,
>  			      session->channels, topology, perf_mode,
>  			      session->bits_per_sample, 0, 0);
>  
> -	if (!copp) {
> +	if (IS_ERR_OR_NULL(copp)) {
>  		mutex_unlock(&routing_data->lock);
>  		return -EINVAL;
>  	}
> -- 
> 2.16.2
>
Srinivas Kandagatla June 26, 2018, 8:53 a.m. UTC | #2
On 25/06/18 19:04, Niklas Cassel wrote:
> On Mon, Jun 25, 2018 at 03:31:15PM +0100, Srinivas Kandagatla wrote:
>> q6adm_open can return error pointer or a null in error cases.
>> Fix this check this.
> Instead of "Fix this check this.", how about "Fix the return handling."

Thanks,  I will reword this!
--srini
>
diff mbox

Patch

diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index caf2f847a886..c18f808c7730 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -310,7 +310,7 @@  int q6routing_stream_open(int fedai_id, int perf_mode,
 			      session->channels, topology, perf_mode,
 			      session->bits_per_sample, 0, 0);
 
-	if (!copp) {
+	if (IS_ERR_OR_NULL(copp)) {
 		mutex_unlock(&routing_data->lock);
 		return -EINVAL;
 	}