lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sehxyqzv.wl-tiwai@suse.de>
Date: Tue, 12 Aug 2025 08:48:52 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Šerif Rami <ramiserifpersia@...il.com>
Cc: Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/7] ALSA: usb-audio: us144mkii: Implement audio playback and feedback

On Sun, 10 Aug 2025 14:49:54 +0200,
Šerif Rami wrote:
> 
> +/**
> + * fpoInitPattern() - Generates a packet distribution pattern.
> + * @size: The number of elements in the pattern array (e.g., 8).
> + * @pattern_array: Pointer to the array to be populated.
> + * @initial_value: The base value to initialize each element with.
> + * @target_sum: The desired sum of all elements in the final array.
> + *
> + * This function initializes an array with a base value and then iteratively
> + * adjusts the elements to match a target sum, distributing the difference
> + * as evenly as possible.
> + */
> +static void fpoInitPattern(unsigned int size, unsigned int *pattern_array,
> +			   unsigned int initial_value, int target_sum)

Any need for camel case only for this?

> +int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
> +{
> +	struct usb_device *dev = tascam->dev;
> +	u8 *rate_payload_buf;
> +	u16 rate_vendor_wValue;
> +	int err = 0;
> +	const u8 *current_payload_src;

Use __free(kfree) for temporary allocation/free for this function.

> @@ -36,29 +209,82 @@ int tascam_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
>  {
>  	struct tascam_card *tascam = snd_pcm_substream_chip(substream);
>  	int err = 0;
> +	int i;
> +	bool do_start = false;
> +	bool do_stop = false;
>  
> -	guard(spinlock_irqsave)(&tascam->lock);
> -	switch (cmd) {
> -	case SNDRV_PCM_TRIGGER_START:
> -	case SNDRV_PCM_TRIGGER_RESUME:
> -		if (!atomic_read(&tascam->playback_active)) {
> -			atomic_set(&tascam->playback_active, 1);
> -			atomic_set(&tascam->capture_active, 1);
> +	{
> +		guard(spinlock_irqsave)(&tascam->lock);

You can use scoped_guard() instead, e.g.

	scoped_guard(spinlock_irqsave, &tascam->lock) {
		switch (cmd) {
		.....
		}
	}


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ