Linux Documentation
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Nicholas Johnson <nicholas.johnson-opensource@outlook.com.au>,
	linux-sound@vger.kernel.org, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-doc@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [RFC PATCH] ALSA: pci: add PreSonus Quantum PCI driver
Date: Fri, 21 Aug 2026 16:24:55 +0200	[thread overview]
Message-ID: <b8eafd53-f9ef-4baf-94c0-4e1ebac12c1f@web.de> (raw)
In-Reply-To: <20260820083646.11383-2-nicholas.johnson-opensource@outlook.com.au>

…
> +++ b/sound/pci/quantum/quantum_dma.c
> @@ -0,0 +1,853 @@
> +static int quantum_build_page_table(struct quantum_chip *chip,
> +				    struct quantum_page_table *pt,
> +				    const struct quantum_stream *stream,
> +				    struct snd_pcm_substream *substream,
> +				    size_t audio_size,
> +				    u32 addr_per_segment)
> +{
…
+	num_segments = (num_pages + addr_per_segment - 1) / addr_per_segment;
+
+	pt->num_entries = num_pages;
+	pt->num_segments = num_segments;
+	pt->addr_per_segment = addr_per_segment;
+	pt->size = num_segments * pt_stride;
+	pt->pages = kcalloc(num_segments, sizeof(*pt->pages), GFP_KERNEL);
+	if (!pt->pages)
+		return -ENOMEM;
…

Can it be nicer to perform any additional variable assignments only after
a successful memory allocation?

Regards,
Markus

  parent reply	other threads:[~2026-08-21 14:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20  8:36 [RFC PATCH 0/1] ALSA: add PreSonus Quantum PCI driver Nicholas Johnson
2026-08-20  8:36 ` [RFC PATCH 1/1] ALSA: pci: " Nicholas Johnson
2026-08-21 12:44   ` [RFC PATCH] " Markus Elfring
2026-08-21 13:00   ` Markus Elfring
2026-08-21 13:34   ` [RFC PATCH 1/1] " Markus Elfring
2026-08-21 14:24   ` Markus Elfring [this message]
2026-08-21 18:10   ` [RFC PATCH] " Markus Elfring
2026-08-22 14:20   ` Markus Elfring
2026-08-22 15:21   ` [RFC PATCH 1/1] " Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8eafd53-f9ef-4baf-94c0-4e1ebac12c1f@web.de \
    --to=markus.elfring@web.de \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicholas.johnson-opensource@outlook.com.au \
    --cc=perex@perex.cz \
    --cc=skhan@linuxfoundation.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox