public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Takashi Iwai <tiwai@suse.de>, linux-sound@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Jaroslav Kysela <perex@perex.cz>,
	Julia Lawall <julia.lawall@inria.fr>
Subject: Re: ALSA: i2c: cs8427: Use common code in snd_cs8427_qsubcode_get()
Date: Tue, 17 Sep 2024 08:33:06 +0200	[thread overview]
Message-ID: <89021934-dc01-44c4-afcd-3baafaec7d80@web.de> (raw)
In-Reply-To: <871q1k9icg.wl-tiwai@suse.de>

>> Add two labels so that a bit of exception handling can be better reused
>> at the end of this function implementation.

The implementation of the function “snd_cs8427_qsubcode_get” was identified
as another update candidate.
https://elixir.bootlin.com/linux/v6.11/source/sound/i2c/cs8427.c#L385
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/sound/i2c/cs8427.c?h=v6.11


> The double goto jumps aren't nice, either.

Would you like to care to avoid a bit of duplicate code from repeated
return statements?
https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources


> I guess we can do clean up better with cleanup.h stuff.

Scope-based resource management can eventually be applied also for
snd_i2c_unlock() calls.
https://elixir.bootlin.com/linux/v6.11/source/include/sound/i2c.h#L76

How do you think about to clarify any software extensions accordingly?

Regards,
Markus

      reply	other threads:[~2024-09-17  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-15 11:48 [PATCH] ALSA: i2c: cs8427: Use common code in snd_cs8427_qsubcode_get() Markus Elfring
2024-09-16  7:18 ` Takashi Iwai
2024-09-17  6:33   ` Markus Elfring [this message]

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=89021934-dc01-44c4-afcd-3baafaec7d80@web.de \
    --to=markus.elfring@web.de \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /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