* [PATCH] driver/pci/asihpi.c fix segfault ASI87xx
@ 2005-02-08 0:50 Eliot Blennerhassett
2005-02-08 20:33 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Eliot Blennerhassett @ 2005-02-08 0:50 UTC (permalink / raw)
To: alsa-devel
Sampleclock control was assumed to exist, actually doesn't in some adapters.
Add error return checks so use of invalid return value doesn't result
(sometimes) in segfault.
--- ../../alsa-driver-1.0.8_clean/pci/asihpi.c 2004-09-23 03:29:17.000000000
+1200
+++ asihpi.c 2005-02-07 16:56:12.000000000 +1300
@@ -1568,8 +1568,8 @@
snd_card_asihpi_t *asihpi = entry->private_data;
HW16 wVersion;
HPI_HCONTROL hControl;
- HW32 dwRate;
- HW16 wSource;
+ HW32 dwRate=0;
+ HW16 wSource=0;
int err;
snd_iprintf(buffer, "ASIHPI driver proc file\n");
@@ -1580,7 +1580,7 @@
wVersion = asihpi->wVersion;
snd_iprintf(buffer,
- "S/N=%ld\nHw Version %c%d\nDSP code version %03d\n",
+ "Serial#=%ld\nHw Version %c%d\nDSP code version %03d\n",
asihpi->dwSerialNumber, ((wVersion >> 3) & 0xf) + 'A',
wVersion & 0x7,
((wVersion >> 13) * 100) + ((wVersion >> 7) & 0x3f));
@@ -1589,10 +1589,13 @@
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &hControl);
- err = HPI_SampleClock_GetSampleRate(phSubSys, hControl, &dwRate);
- err = HPI_SampleClock_GetSource(phSubSys, hControl, &wSource);
- snd_iprintf(buffer, "SampleClock=%ldHz, source %s\n", dwRate,
- sampleclock_sources[wSource]);
+ if (!err) {
+ err = HPI_SampleClock_GetSampleRate(phSubSys,
hControl, &dwRate);
+ err = HPI_SampleClock_GetSource(phSubSys, hControl,
&wSource);
+ snd_iprintf(buffer, "SampleClock=%ldHz, source %s\n",
dwRate,
+ sampleclock_sources[wSource]);
+ }
+
}
@@ -1671,8 +1674,8 @@
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &hControl);
- err =
- HPI_SampleClock_SetSampleRate(phSubSys, hControl, adapter_fs);
+ if (!err)
+ err = HPI_SampleClock_SetSampleRate(phSubSys,
hControl, adapter_fs);
snd_asihpi_proc_init(asihpi);
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] driver/pci/asihpi.c fix segfault ASI87xx
2005-02-08 0:50 [PATCH] driver/pci/asihpi.c fix segfault ASI87xx Eliot Blennerhassett
@ 2005-02-08 20:33 ` Takashi Iwai
2005-02-08 20:56 ` Eliot Blennerhassett
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2005-02-08 20:33 UTC (permalink / raw)
To: Eliot Blennerhassett; +Cc: alsa-devel
Hi Eliot,
At Tue, 8 Feb 2005 13:50:28 +1300,
Eliot Blennerhassett wrote:
>
> Sampleclock control was assumed to exist, actually doesn't in some adapters.
> Add error return checks so use of invalid return value doesn't result
> (sometimes) in segfault.
Looks like your mailer broke the patch.
Please attach the patch instead of pasting.
Also, don't forget to give "Signed-off-by" for changelog.
thanks,
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] driver/pci/asihpi.c fix segfault ASI87xx
2005-02-08 20:33 ` Takashi Iwai
@ 2005-02-08 20:56 ` Eliot Blennerhassett
2005-02-08 21:22 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Eliot Blennerhassett @ 2005-02-08 20:56 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
On Wed, 09 Feb 2005 09:33, Takashi Iwai wrote:
> Hi Eliot,
>
> At Tue, 8 Feb 2005 13:50:28 +1300,
>
> Eliot Blennerhassett wrote:
> > Sampleclock control was assumed to exist, actually doesn't in some
> > adapters. Add error return checks so use of invalid return value doesn't
> > result (sometimes) in segfault.
>
> Looks like your mailer broke the patch.
Oops. Thanks for letting me know.
> Please attach the patch instead of pasting.
here
> Also, don't forget to give "Signed-off-by" for changelog.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
OK this time I hope
-- Eliot
[-- Attachment #2: asihpi_sclock.patch --]
[-- Type: text/x-diff, Size: 1676 bytes --]
--- ../../alsa-driver-1.0.8_clean/pci/asihpi.c 2004-09-23 03:29:17.000000000 +1200
+++ asihpi.c 2005-02-08 13:44:18.000000000 +1300
@@ -1568,8 +1568,8 @@
snd_card_asihpi_t *asihpi = entry->private_data;
HW16 wVersion;
HPI_HCONTROL hControl;
- HW32 dwRate;
- HW16 wSource;
+ HW32 dwRate=0;
+ HW16 wSource=0;
int err;
snd_iprintf(buffer, "ASIHPI driver proc file\n");
@@ -1580,7 +1580,7 @@
wVersion = asihpi->wVersion;
snd_iprintf(buffer,
- "S/N=%ld\nHw Version %c%d\nDSP code version %03d\n",
+ "Serial#=%ld\nHw Version %c%d\nDSP code version %03d\n",
asihpi->dwSerialNumber, ((wVersion >> 3) & 0xf) + 'A',
wVersion & 0x7,
((wVersion >> 13) * 100) + ((wVersion >> 7) & 0x3f));
@@ -1589,10 +1589,15 @@
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &hControl);
- err = HPI_SampleClock_GetSampleRate(phSubSys, hControl, &dwRate);
- err = HPI_SampleClock_GetSource(phSubSys, hControl, &wSource);
- snd_iprintf(buffer, "SampleClock=%ldHz, source %s\n", dwRate,
- sampleclock_sources[wSource]);
+ if (!err) {
+ err = HPI_SampleClock_GetSampleRate(phSubSys, hControl, &dwRate);
+ err += HPI_SampleClock_GetSource(phSubSys, hControl, &wSource);
+
+ if (!err)
+ snd_iprintf(buffer, "SampleClock=%ldHz, source %s\n", dwRate,
+ sampleclock_sources[wSource]);
+ }
+
}
@@ -1671,8 +1676,8 @@
HPI_SOURCENODE_CLOCK_SOURCE, 0, 0, 0,
HPI_CONTROL_SAMPLECLOCK, &hControl);
- err =
- HPI_SampleClock_SetSampleRate(phSubSys, hControl, adapter_fs);
+ if (!err)
+ err = HPI_SampleClock_SetSampleRate(phSubSys, hControl, adapter_fs);
snd_asihpi_proc_init(asihpi);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] driver/pci/asihpi.c fix segfault ASI87xx
2005-02-08 20:56 ` Eliot Blennerhassett
@ 2005-02-08 21:22 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2005-02-08 21:22 UTC (permalink / raw)
To: Eliot Blennerhassett; +Cc: alsa-devel
At Wed, 9 Feb 2005 09:56:11 +1300,
Eliot Blennerhassett wrote:
>
> On Wed, 09 Feb 2005 09:33, Takashi Iwai wrote:
> > Hi Eliot,
> >
> > At Tue, 8 Feb 2005 13:50:28 +1300,
> >
> > Eliot Blennerhassett wrote:
> > > Sampleclock control was assumed to exist, actually doesn't in some
> > > adapters. Add error return checks so use of invalid return value doesn't
> > > result (sometimes) in segfault.
> >
> > Looks like your mailer broke the patch.
>
> Oops. Thanks for letting me know.
>
> > Please attach the patch instead of pasting.
>
> here
>
> > Also, don't forget to give "Signed-off-by" for changelog.
>
> Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
>
> OK this time I hope
Thanks, now applied to CVS.
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-02-08 21:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-08 0:50 [PATCH] driver/pci/asihpi.c fix segfault ASI87xx Eliot Blennerhassett
2005-02-08 20:33 ` Takashi Iwai
2005-02-08 20:56 ` Eliot Blennerhassett
2005-02-08 21:22 ` Takashi Iwai
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.