Re: [RFC PATCH 3/8] ivtv/cx18: fix compiler warnings
On Mon, 2012-04-23 at 13:38 +0200, Hans Verkuil wrote: media_build/v4l/cx18-alsa-main.c: In function 'cx18_alsa_exit': media_build/v4l/cx18-alsa-main.c:282:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-mailbox.c: In function 'cx18_api_call': media_build/v4l/cx18-mailbox.c:598:6: warning: variable 'state' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-alsa-pcm.c: In function 'snd_cx18_pcm_capture_open': media_build/v4l/cx18-alsa-pcm.c:156:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-alsa-pcm.c: In function 'snd_cx18_pcm_capture_close': media_build/v4l/cx18-alsa-pcm.c:202:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-alsa-pcm.c: In function 'snd_cx18_pcm_hw_params': media_build/v4l/cx18-alsa-pcm.c:255:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-streams.c: In function 'cx18_stop_v4l2_encode_stream': media_build/v4l/cx18-streams.c:983:16: warning: variable 'then' set but not used [-Wunused-but-set-variable] media_build/v4l/ivtv-ioctl.c: In function 'ivtv_set_speed': media_build/v4l/ivtv-ioctl.c:138:22: warning: variable 's' set but not used [-Wunused-but-set-variable] media_build/v4l/ivtvfb.c: In function 'ivtvfb_init': media_build/v4l/ivtvfb.c:1286:6: warning: variable 'err' set but not used [-Wunused-but-set-variable] media_build/v4l/ivtvfb.c: In function 'ivtvfb_cleanup': media_build/v4l/ivtvfb.c:1306:6: warning: variable 'err' set but not used [-Wunused-but-set-variable] Signed-off-by: Hans Verkuil hans.verk...@cisco.com Looks ok. Reviewed-by: Andy Walls awa...@md.metrocast.net Some comments of no consequence are below... -Andy --- drivers/media/video/cx18/cx18-alsa-main.c |1 + drivers/media/video/cx18/cx18-alsa-pcm.c | 10 +++--- drivers/media/video/cx18/cx18-mailbox.c |6 +- drivers/media/video/cx18/cx18-streams.c |3 --- drivers/media/video/ivtv/ivtv-ioctl.c |3 --- drivers/media/video/ivtv/ivtvfb.c |2 ++ 6 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/cx18/cx18-alsa-main.c b/drivers/media/video/cx18/cx18-alsa-main.c index e118361..6d2a982 100644 --- a/drivers/media/video/cx18/cx18-alsa-main.c +++ b/drivers/media/video/cx18/cx18-alsa-main.c @@ -285,6 +285,7 @@ static void __exit cx18_alsa_exit(void) drv = driver_find(cx18, pci_bus_type); ret = driver_for_each_device(drv, NULL, NULL, cx18_alsa_exit_callback); + (void)ret; /* suppress compiler warning */ Why not just remove 'ret', which is what the rest of the changeset does in similar situations? No big deal though. It is fine as is. cx18_ext_init = NULL; printk(KERN_INFO cx18-alsa: module unload complete\n); diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.c b/drivers/media/video/cx18/cx18-alsa-pcm.c index 82d195b..7a5b84a 100644 --- a/drivers/media/video/cx18/cx18-alsa-pcm.c +++ b/drivers/media/video/cx18/cx18-alsa-pcm.c @@ -190,7 +190,7 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream) ret = cx18_start_v4l2_encode_stream(s); snd_cx18_unlock(cxsc); - return 0; + return ret; } Ugh. I need to change this code to set the streaming flag based on the success of getting the stream started. Your change is fine though. static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) @@ -199,12 +199,11 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) struct v4l2_device *v4l2_dev = cxsc-v4l2_dev; struct cx18 *cx = to_cx18(v4l2_dev); struct cx18_stream *s; - int ret; /* Instruct the cx18 to stop sending packets */ snd_cx18_lock(cxsc); s = cx-streams[CX18_ENC_STREAM_TYPE_PCM]; - ret = cx18_stop_v4l2_encode_stream(s, 0); + cx18_stop_v4l2_encode_stream(s, 0); clear_bit(CX18_F_S_STREAMING, s-s_flags); cx18_release_stream(s); @@ -252,13 +251,10 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, static int snd_cx18_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - int ret; - dprintk(%s called\n, __func__); - ret = snd_pcm_alloc_vmalloc_buffer(substream, + return snd_pcm_alloc_vmalloc_buffer(substream, params_buffer_bytes(params)); - return 0; } static int snd_cx18_pcm_hw_free(struct snd_pcm_substream *substream) diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c index 0c7796e..ed81183 100644 --- a/drivers/media/video/cx18/cx18-mailbox.c +++ b/drivers/media/video/cx18/cx18-mailbox.c @@ -595,9 +595,8 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
[RFC PATCH 3/8] ivtv/cx18: fix compiler warnings
media_build/v4l/cx18-alsa-main.c: In function 'cx18_alsa_exit': media_build/v4l/cx18-alsa-main.c:282:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-mailbox.c: In function 'cx18_api_call': media_build/v4l/cx18-mailbox.c:598:6: warning: variable 'state' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-alsa-pcm.c: In function 'snd_cx18_pcm_capture_open': media_build/v4l/cx18-alsa-pcm.c:156:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-alsa-pcm.c: In function 'snd_cx18_pcm_capture_close': media_build/v4l/cx18-alsa-pcm.c:202:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-alsa-pcm.c: In function 'snd_cx18_pcm_hw_params': media_build/v4l/cx18-alsa-pcm.c:255:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/cx18-streams.c: In function 'cx18_stop_v4l2_encode_stream': media_build/v4l/cx18-streams.c:983:16: warning: variable 'then' set but not used [-Wunused-but-set-variable] media_build/v4l/ivtv-ioctl.c: In function 'ivtv_set_speed': media_build/v4l/ivtv-ioctl.c:138:22: warning: variable 's' set but not used [-Wunused-but-set-variable] media_build/v4l/ivtvfb.c: In function 'ivtvfb_init': media_build/v4l/ivtvfb.c:1286:6: warning: variable 'err' set but not used [-Wunused-but-set-variable] media_build/v4l/ivtvfb.c: In function 'ivtvfb_cleanup': media_build/v4l/ivtvfb.c:1306:6: warning: variable 'err' set but not used [-Wunused-but-set-variable] Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/video/cx18/cx18-alsa-main.c |1 + drivers/media/video/cx18/cx18-alsa-pcm.c | 10 +++--- drivers/media/video/cx18/cx18-mailbox.c |6 +- drivers/media/video/cx18/cx18-streams.c |3 --- drivers/media/video/ivtv/ivtv-ioctl.c |3 --- drivers/media/video/ivtv/ivtvfb.c |2 ++ 6 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/cx18/cx18-alsa-main.c b/drivers/media/video/cx18/cx18-alsa-main.c index e118361..6d2a982 100644 --- a/drivers/media/video/cx18/cx18-alsa-main.c +++ b/drivers/media/video/cx18/cx18-alsa-main.c @@ -285,6 +285,7 @@ static void __exit cx18_alsa_exit(void) drv = driver_find(cx18, pci_bus_type); ret = driver_for_each_device(drv, NULL, NULL, cx18_alsa_exit_callback); + (void)ret; /* suppress compiler warning */ cx18_ext_init = NULL; printk(KERN_INFO cx18-alsa: module unload complete\n); diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.c b/drivers/media/video/cx18/cx18-alsa-pcm.c index 82d195b..7a5b84a 100644 --- a/drivers/media/video/cx18/cx18-alsa-pcm.c +++ b/drivers/media/video/cx18/cx18-alsa-pcm.c @@ -190,7 +190,7 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream) ret = cx18_start_v4l2_encode_stream(s); snd_cx18_unlock(cxsc); - return 0; + return ret; } static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) @@ -199,12 +199,11 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) struct v4l2_device *v4l2_dev = cxsc-v4l2_dev; struct cx18 *cx = to_cx18(v4l2_dev); struct cx18_stream *s; - int ret; /* Instruct the cx18 to stop sending packets */ snd_cx18_lock(cxsc); s = cx-streams[CX18_ENC_STREAM_TYPE_PCM]; - ret = cx18_stop_v4l2_encode_stream(s, 0); + cx18_stop_v4l2_encode_stream(s, 0); clear_bit(CX18_F_S_STREAMING, s-s_flags); cx18_release_stream(s); @@ -252,13 +251,10 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, static int snd_cx18_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - int ret; - dprintk(%s called\n, __func__); - ret = snd_pcm_alloc_vmalloc_buffer(substream, + return snd_pcm_alloc_vmalloc_buffer(substream, params_buffer_bytes(params)); - return 0; } static int snd_cx18_pcm_hw_free(struct snd_pcm_substream *substream) diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c index 0c7796e..ed81183 100644 --- a/drivers/media/video/cx18/cx18-mailbox.c +++ b/drivers/media/video/cx18/cx18-mailbox.c @@ -595,9 +595,8 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[]) { const struct cx18_api_info *info = find_api_info(cmd); - u32 state, irq, req, ack, err; + u32 irq, req, ack, err; struct cx18_mailbox __iomem *mb; - u32 __iomem *xpu_state; wait_queue_head_t *waitq; struct mutex *mb_lock; unsigned long int t0, timeout, ret; @@ -628,14 +627,12 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])