Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1401095
| From | Takashi Iwai <tiwai@suse.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus |
| Date | 2016-05-14 17:20 +0200 |
| Message-ID | <ryJwd-2VN-3@gated-at.bofh.it> (permalink) |
| References | <rtKsW-6dE-3@gated-at.bofh.it> <rtKsW-6dE-5@gated-at.bofh.it> <rwPPr-2FZ-1@gated-at.bofh.it> <ryEwy-6u9-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, 14 May 2016 11:50:50 +0200,
Robert Jarzmik wrote:
> >> +unsigned int ac97_bus_scan_one(struct ac97_controller *ac97,
> >> + int codec_num)
> >> +{
> >> + struct ac97_codec_device codec;
> >> + unsigned short vid1, vid2;
> >> + int ret;
> >> +
> >> + codec.dev = *ac97->dev;
> >> + codec.num = codec_num;
> >> + ret = ac97->ops->read(&codec, AC97_VENDOR_ID1);
> >> + vid1 = (ret & 0xffff);
> >> + if (ret < 0)
> >> + return 0;
> >
> > Hmm. This looks pretty hackish and dangerous.
> You mean returning 0 even if the read failed, right ?
No, my concern is that it's creating a dummy codec object temporarily
on the stack just by copying some fields and calling the ops with it.
(And actually the current code may work wrongly because lack of
zero-clear of the object.)
IMO, a cleaner way would be to define the ops passed with both
controller and codec objects as arguments, and pass NULL codec here.
Takashi
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus Robert Jarzmik <robert.jarzmik@free.fr> - 2016-05-14 12:00 +0200
Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus Takashi Iwai <tiwai@suse.de> - 2016-05-14 17:20 +0200
Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus Robert Jarzmik <robert.jarzmik@free.fr> - 2016-05-16 04:10 +0200
Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus Takashi Iwai <tiwai@suse.de> - 2016-05-16 07:50 +0200
Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus Robert Jarzmik <robert.jarzmik@free.fr> - 2016-05-16 11:00 +0200
Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus Takashi Iwai <tiwai@suse.de> - 2016-05-16 15:00 +0200
Re: [RFC PATCH 2/7] ALSA: ac97: add an ac97 bus Mark Brown <broonie@kernel.org> - 2016-05-16 15:20 +0200
csiph-web