All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless
@ 2023-01-06  9:35 Dan Carpenter
  2023-01-09 14:20 ` Jaroslav Kysela
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-01-06  9:35 UTC (permalink / raw)
  To: perex; +Cc: alsa-devel

Hello Jaroslav Kysela,

The patch fd28941cff1c: "ALSA: usb-audio: Add new quirk FIXED_RATE
for JBL Quantum810 Wireless" from Dec 15, 2022, leads to the
following Smatch static checker warning:

	sound/usb/pcm.c:543 snd_usb_hw_params()
	error: uninitialized symbol 'sync_fixed_rate'.

sound/usb/pcm.c
    471 static int snd_usb_hw_params(struct snd_pcm_substream *substream,
    472                              struct snd_pcm_hw_params *hw_params)
    473 {
    474         struct snd_usb_substream *subs = substream->runtime->private_data;
    475         struct snd_usb_audio *chip = subs->stream->chip;
    476         const struct audioformat *fmt;
    477         const struct audioformat *sync_fmt;
    478         bool fixed_rate, sync_fixed_rate;
    479         int ret;
    480 
    481         ret = snd_media_start_pipeline(subs);
    482         if (ret)
    483                 return ret;
    484 
    485         fixed_rate = snd_usb_pcm_has_fixed_rate(subs);
    486         fmt = find_substream_format(subs, hw_params);
    487         if (!fmt) {
    488                 usb_audio_dbg(chip,
    489                               "cannot find format: format=%s, rate=%d, channels=%d\n",
    490                               snd_pcm_format_name(params_format(hw_params)),
    491                               params_rate(hw_params), params_channels(hw_params));
    492                 ret = -EINVAL;
    493                 goto stop_pipeline;
    494         }
    495 
    496         if (fmt->implicit_fb) {
    497                 sync_fmt = snd_usb_find_implicit_fb_sync_format(chip, fmt,
    498                                                                 hw_params,
    499                                                                 !substream->stream,
    500                                                                 &sync_fixed_rate);

"sync_fixed_rate" is uninitialized when we "Use the original audioformat
as fallback for the shared altset" and find_matching_substream() returns
NULL.

    501                 if (!sync_fmt) {
    502                         usb_audio_dbg(chip,
    503                                       "cannot find sync format: ep=0x%x, iface=%d:%d, format=%s, rate=%d, channels=%d\n",
    504                                       fmt->sync_ep, fmt->sync_iface,
    505                                       fmt->sync_altsetting,
    506                                       snd_pcm_format_name(params_format(hw_params)),
    507                                       params_rate(hw_params), params_channels(hw_params));
    508                         ret = -EINVAL;
    509                         goto stop_pipeline;
    510                 }
    511         } else {
    512                 sync_fmt = fmt;
    513                 sync_fixed_rate = fixed_rate;
    514         }
    515 
    516         ret = snd_usb_lock_shutdown(chip);
    517         if (ret < 0)
    518                 goto stop_pipeline;
    519 
    520         ret = snd_usb_pcm_change_state(subs, UAC3_PD_STATE_D0);
    521         if (ret < 0)
    522                 goto unlock;
    523 
    524         if (subs->data_endpoint) {
    525                 if (snd_usb_endpoint_compatible(chip, subs->data_endpoint,
    526                                                 fmt, hw_params))
    527                         goto unlock;
    528                 if (stop_endpoints(subs, false))
    529                         sync_pending_stops(subs);
    530                 close_endpoints(chip, subs);
    531         }
    532 
    533         subs->data_endpoint = snd_usb_endpoint_open(chip, fmt, hw_params, false, fixed_rate);
    534         if (!subs->data_endpoint) {
    535                 ret = -EINVAL;
    536                 goto unlock;
    537         }
    538 
    539         if (fmt->sync_ep) {
    540                 subs->sync_endpoint = snd_usb_endpoint_open(chip, sync_fmt,
    541                                                             hw_params,
    542                                                             fmt == sync_fmt,
--> 543                                                             sync_fixed_rate);
    544                 if (!subs->sync_endpoint) {
    545                         ret = -EINVAL;
    546                         goto unlock;
    547                 }

regards,
dan carpenter

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

* Re: [bug report] ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless
  2023-01-06  9:35 [bug report] ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless Dan Carpenter
@ 2023-01-09 14:20 ` Jaroslav Kysela
  0 siblings, 0 replies; 2+ messages in thread
From: Jaroslav Kysela @ 2023-01-09 14:20 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: alsa-devel

On 06. 01. 23 10:35, Dan Carpenter wrote:
> Hello Jaroslav Kysela,
> 
> The patch fd28941cff1c: "ALSA: usb-audio: Add new quirk FIXED_RATE
> for JBL Quantum810 Wireless" from Dec 15, 2022, leads to the
> following Smatch static checker warning:
> 
> 	sound/usb/pcm.c:543 snd_usb_hw_params()
> 	error: uninitialized symbol 'sync_fixed_rate'.

...

>      496         if (fmt->implicit_fb) {
>      497                 sync_fmt = snd_usb_find_implicit_fb_sync_format(chip, fmt,
>      498                                                                 hw_params,
>      499                                                                 !substream->stream,
>      500                                                                 &sync_fixed_rate);
> 
> "sync_fixed_rate" is uninitialized when we "Use the original audioformat
> as fallback for the shared altset" and find_matching_substream() returns
> NULL.

Thanks. The fix was sent:

https://lore.kernel.org/alsa-devel/20230109141133.335543-1-perex@perex.cz/

						Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

end of thread, other threads:[~2023-01-09 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06  9:35 [bug report] ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless Dan Carpenter
2023-01-09 14:20 ` Jaroslav Kysela

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.