From: Mark Brown <broonie@kernel.org>
To: Nikola Ivanov <zlatistiv@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, shuah@kernel.org,
linux-sound@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH] selftests/alsa: remove 0/NULL global variable assignment
Date: Thu, 21 Aug 2025 22:30:50 +0100 [thread overview]
Message-ID: <f7ff446f-2a9e-49dc-af7a-6e4c76803471@sirena.org.uk> (raw)
In-Reply-To: <CAHjv_as7m7UbSLAPU6hX_=tAvLZYR_7Q=1n+Xq-nW-6OJ237PA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
On Fri, Aug 22, 2025 at 12:17:14AM +0300, Nikola Ivanov wrote:
> On Thu, Aug 21, 2025 at 09:49:29PM +0100, Mark Brown wrote:
> > > -int num_cards = 0;
> > > -int num_controls = 0;
> > > -struct card_data *card_list = NULL;
> > > -struct ctl_data *ctl_list = NULL;
> > > +int num_cards;
> > > +int num_controls;
> > > +struct card_data *card_list;
> > > +struct ctl_data *ctl_list;
> > Nothing now sets initial values for these variables so they all have
> > undefined values which is buggy. The code is relying on the default
> > values.
> Checkpatch reports it as an error, it looks to be part of the C
> standard that all compilers must initialize globals to 0.
> Though I suppose it helps with readability to see
> the num_ counters assigned 0.
Do you have a reference there, note that these are just plain non-static
variables? I wouldn't trust checkpatch for anything that isn't kernel
code (and even there it's got issues).
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-08-21 21:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 20:01 Nikola Z. Ivanov
2025-08-21 20:49 ` Mark Brown
2025-08-21 21:17 ` Nikola Ivanov
2025-08-21 21:30 ` Mark Brown [this message]
2025-08-21 22:57 ` Nikola Z. Ivanov
2025-08-21 23:14 ` Mark Brown
2025-08-22 6:21 ` Takashi Iwai
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=f7ff446f-2a9e-49dc-af7a-6e4c76803471@sirena.org.uk \
--to=broonie@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=tiwai@suse.com \
--cc=zlatistiv@gmail.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
all inboxes | Powered by JetHome®