All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: x86: hdmi: fix returnvar.cocci warnings
@ 2017-01-24 16:07 Julia Lawall
  2017-01-25 21:08 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2017-01-24 16:07 UTC (permalink / raw)
  To: Jerome Anand
  Cc: alsa-devel, tiwai, intel-gfx, broonie, rakesh.a.ughreja, kbuild-all

Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

CC: Jerome Anand <jerome.anand@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

In-Reply-To: <20170124225753.9045-5-jerome.anand@intel.com>
url:
https://github.com/0day-ci/linux/commits/Jerome-Anand/Add-support-for-Legacy
-HDMI-audio-drivers/20170124-213547

This is probably not the right patch.  It si just what the rule generates.
Instead, I guess that retval should be updated in some way?

 intel_hdmi_audio_if.c |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

--- a/sound/x86/intel_hdmi_audio_if.c
+++ b/sound/x86/intel_hdmi_audio_if.c
@@ -239,7 +239,6 @@ static inline int had_chk_intrmiss(struc

 int had_process_buffer_done(struct snd_intelhad *intelhaddata)
 {
-	int retval = 0;
 	u32 len = 1;
 	enum intel_had_aud_buf_type buf_id;
 	enum intel_had_aud_buf_type buff_done;
@@ -258,7 +257,7 @@ int had_process_buffer_done(struct snd_i
 	if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
 		spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
 		pr_err("%s:Device already disconnected\n", __func__);
-		return retval;
+		return 0;
 	}
 	buf_id = intelhaddata->curr_buf;
 	intelhaddata->buff_done = buf_id;
@@ -280,7 +279,7 @@ int had_process_buffer_done(struct snd_i
 		if (!intr_count || (intr_count > 3)) {
 			pr_err("HAD SW state in non-recoverable!!! mode\n");
 			pr_err("Already played stale data\n");
-			return retval;
+			return 0;
 		}
 		buf_id += (intr_count - 1);
 		buf_id = buf_id % 4;
@@ -298,7 +297,7 @@ int had_process_buffer_done(struct snd_i

 	if (had_get_hwstate(intelhaddata)) {
 		pr_err("HDMI cable plugged-out\n");
-		return retval;
+		return 0;
 	}

 	/*Reprogram the registers with addr and length*/
@@ -322,12 +321,11 @@ int had_process_buffer_done(struct snd_i
 		stream->period_elapsed(stream->had_substream);
 	}

-	return retval;
+	return 0;
 }

 int had_process_buffer_underrun(struct snd_intelhad *intelhaddata)
 {
-	int retval = 0;
 	enum intel_had_aud_buf_type buf_id;
 	struct pcm_stream_info *stream;
 	struct had_pvt_data *had_stream;
@@ -355,7 +353,7 @@ int had_process_buffer_underrun(struct s

 	if (drv_status == HAD_DRV_DISCONNECTED) {
 		pr_err("%s:Device already disconnected\n", __func__);
-		return retval;
+		return 0;
 	}

 	if (stream_type == HAD_RUNNING_STREAM) {
@@ -364,12 +362,11 @@ int had_process_buffer_underrun(struct s
 		stream->period_elapsed(stream->had_substream);
 	}

-	return retval;
+	return 0;
 }

 int had_process_hot_plug(struct snd_intelhad *intelhaddata)
 {
-	int retval = 0;
 	enum intel_had_aud_buf_type buf_id;
 	struct snd_pcm_substream *substream;
 	struct had_pvt_data *had_stream;
@@ -384,7 +381,7 @@ int had_process_hot_plug(struct snd_inte
 	if (intelhaddata->drv_status == HAD_DRV_CONNECTED) {
 		pr_debug("Device already connected\n");
 		spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
-		return retval;
+		return 0;
 	}
 	buf_id = intelhaddata->curr_buf;
 	intelhaddata->buff_done = buf_id;
@@ -422,12 +419,12 @@ int had_process_hot_plug(struct snd_inte

 	had_build_channel_allocation_map(intelhaddata);

-	return retval;
+	return 0;

 err:
 	pm_runtime_disable(intelhaddata->dev);
 	intelhaddata->dev = NULL;
-	return retval;
+	return 0;
 }

 int had_process_hot_unplug(struct snd_intelhad *intelhaddata)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: x86: hdmi: fix returnvar.cocci warnings
  2017-01-24 16:07 [PATCH] ALSA: x86: hdmi: fix returnvar.cocci warnings Julia Lawall
@ 2017-01-25 21:08 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2017-01-25 21:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: alsa-devel, intel-gfx, broonie, rakesh.a.ughreja, kbuild-all

On Tue, 24 Jan 2017 17:07:48 +0100,
Julia Lawall wrote:
> 
> Remove unneeded variable used to store return value.
> 
> Generated by: scripts/coccinelle/misc/returnvar.cocci
> 
> CC: Jerome Anand <jerome.anand@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
> In-Reply-To: <20170124225753.9045-5-jerome.anand@intel.com>
> url:
> https://github.com/0day-ci/linux/commits/Jerome-Anand/Add-support-for-Legacy
> -HDMI-audio-drivers/20170124-213547
> 
> This is probably not the right patch.  It si just what the rule generates.
> Instead, I guess that retval should be updated in some way?

Yeah, it looks a bit suspicious, but it can be fixed later.
So I applied your cleanup now.


thanks,

Takashi

> 
>  intel_hdmi_audio_if.c |   21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> --- a/sound/x86/intel_hdmi_audio_if.c
> +++ b/sound/x86/intel_hdmi_audio_if.c
> @@ -239,7 +239,6 @@ static inline int had_chk_intrmiss(struc
> 
>  int had_process_buffer_done(struct snd_intelhad *intelhaddata)
>  {
> -	int retval = 0;
>  	u32 len = 1;
>  	enum intel_had_aud_buf_type buf_id;
>  	enum intel_had_aud_buf_type buff_done;
> @@ -258,7 +257,7 @@ int had_process_buffer_done(struct snd_i
>  	if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
>  		spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
>  		pr_err("%s:Device already disconnected\n", __func__);
> -		return retval;
> +		return 0;
>  	}
>  	buf_id = intelhaddata->curr_buf;
>  	intelhaddata->buff_done = buf_id;
> @@ -280,7 +279,7 @@ int had_process_buffer_done(struct snd_i
>  		if (!intr_count || (intr_count > 3)) {
>  			pr_err("HAD SW state in non-recoverable!!! mode\n");
>  			pr_err("Already played stale data\n");
> -			return retval;
> +			return 0;
>  		}
>  		buf_id += (intr_count - 1);
>  		buf_id = buf_id % 4;
> @@ -298,7 +297,7 @@ int had_process_buffer_done(struct snd_i
> 
>  	if (had_get_hwstate(intelhaddata)) {
>  		pr_err("HDMI cable plugged-out\n");
> -		return retval;
> +		return 0;
>  	}
> 
>  	/*Reprogram the registers with addr and length*/
> @@ -322,12 +321,11 @@ int had_process_buffer_done(struct snd_i
>  		stream->period_elapsed(stream->had_substream);
>  	}
> 
> -	return retval;
> +	return 0;
>  }
> 
>  int had_process_buffer_underrun(struct snd_intelhad *intelhaddata)
>  {
> -	int retval = 0;
>  	enum intel_had_aud_buf_type buf_id;
>  	struct pcm_stream_info *stream;
>  	struct had_pvt_data *had_stream;
> @@ -355,7 +353,7 @@ int had_process_buffer_underrun(struct s
> 
>  	if (drv_status == HAD_DRV_DISCONNECTED) {
>  		pr_err("%s:Device already disconnected\n", __func__);
> -		return retval;
> +		return 0;
>  	}
> 
>  	if (stream_type == HAD_RUNNING_STREAM) {
> @@ -364,12 +362,11 @@ int had_process_buffer_underrun(struct s
>  		stream->period_elapsed(stream->had_substream);
>  	}
> 
> -	return retval;
> +	return 0;
>  }
> 
>  int had_process_hot_plug(struct snd_intelhad *intelhaddata)
>  {
> -	int retval = 0;
>  	enum intel_had_aud_buf_type buf_id;
>  	struct snd_pcm_substream *substream;
>  	struct had_pvt_data *had_stream;
> @@ -384,7 +381,7 @@ int had_process_hot_plug(struct snd_inte
>  	if (intelhaddata->drv_status == HAD_DRV_CONNECTED) {
>  		pr_debug("Device already connected\n");
>  		spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
> -		return retval;
> +		return 0;
>  	}
>  	buf_id = intelhaddata->curr_buf;
>  	intelhaddata->buff_done = buf_id;
> @@ -422,12 +419,12 @@ int had_process_hot_plug(struct snd_inte
> 
>  	had_build_channel_allocation_map(intelhaddata);
> 
> -	return retval;
> +	return 0;
> 
>  err:
>  	pm_runtime_disable(intelhaddata->dev);
>  	intelhaddata->dev = NULL;
> -	return retval;
> +	return 0;
>  }
> 
>  int had_process_hot_unplug(struct snd_intelhad *intelhaddata)
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-25 21:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 16:07 [PATCH] ALSA: x86: hdmi: fix returnvar.cocci warnings Julia Lawall
2017-01-25 21:08 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.