On Thu, Jul 13, 2000 at 05:20:52PM +0100, Alan Cox wrote:
> > /* Register devices */
> > - if ((card->audio1_num = register_sound_dsp(&emu10k1_audio_fops, -1)) < 0) {
> > + if ((signed long)(card->audio1_num = register_sound_dsp(&emu10k1_audio_fops, -1)) < 0) {
>
> Fix the type of card->foo_num to be signed instead - the fix is right.
>
I disagree here. If you enumerate things, you have zero or more
of them. _Never_ owe you (as the kernel) somebody a soundcard ;-)
So fix is:
signed long ret = register_sound_dsp(&emu10k1_audio_fops, -1);
if (ret < 0) {
/* Error handling or jump to it */
} else {
card->audio1_num = ret;
};
This is _always_ the safe variant, when you like to indicate
errors as negative values, but positive values as the "real"
return values.
Otherwise you have to check for "< 0" every time you look at the
signed variable (if you are a clean coder ;-)).
Regards
Ingo Oeser
-- Feel the power of the penguin - run linux@your.pc <esc>:x- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:17 EST