From: Jeff Garzik <jgarzik@pobox.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Re: PATCH: switch maestro3 to new ac97
Date: Fri, 11 Jul 2003 14:48:23 -0400 [thread overview]
Message-ID: <20030711184822.GE16037@gtf.org> (raw)
In-Reply-To: <200307111815.h6BIFQET017362@hraefn.swansea.linux.org.uk>
On Fri, Jul 11, 2003 at 07:15:26PM +0100, Alan Cox wrote:
> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.75/sound/oss/maestro3.c linux-2.5.75-ac1/sound/oss/maestro3.c
> --- linux-2.5.75/sound/oss/maestro3.c 2003-07-10 21:14:15.000000000 +0100
> +++ linux-2.5.75-ac1/sound/oss/maestro3.c 2003-07-11 16:47:14.000000000 +0100
> @@ -2301,9 +2301,8 @@
> {
> struct ac97_codec *codec;
>
> - if ((codec = kmalloc(sizeof(struct ac97_codec), GFP_KERNEL)) == NULL)
> + if ((codec = ac97_alloc_codec()) == NULL)
> return -ENOMEM;
> - memset(codec, 0, sizeof(struct ac97_codec));
>
> codec->private_data = card;
> codec->codec_read = m3_ac97_read;
> @@ -2313,13 +2312,13 @@
>
> if (ac97_probe_codec(codec) == 0) {
> printk(KERN_ERR PFX "codec probe failed\n");
> - kfree(codec);
> + ac97_release_codec(codec);
> return -1;
> }
>
> if ((codec->dev_mixer = register_sound_mixer(&m3_mixer_fops, -1)) < 0) {
> printk(KERN_ERR PFX "couldn't register mixer!\n");
> - kfree(codec);
> + ac97_release_codec(codec);
I note another positive attribute as well:
This new AC97 stuff makes object lifetime much more obvious, and makes
it easy for someone to add refcounting later, if that comes up.
This patch is an excellent example of such.
Jeff
next prev parent reply other threads:[~2003-07-11 19:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-11 18:15 PATCH: switch maestro3 to new ac97 Alan Cox
2003-07-11 18:48 ` Jeff Garzik [this message]
2003-07-11 21:56 ` Alan Cox
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=20030711184822.GE16037@gtf.org \
--to=jgarzik@pobox.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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 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.