Re: script to find incorrect tests on unsigneds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Does the initialization of result in the following code serve any purpose?

sound/isa/sb/sb_common.c:

 static int snd_sbdsp_version(struct snd_sb * chip)
 {
        unsigned int result = -ENODEV;

        snd_sbdsp_command(chip, SB_DSP_GET_VERSION);
        result = (short) snd_sbdsp_get_byte(chip) << 8;

If result is unsigned, its value will never be -ENODEV, and anyway the 
value is overwritten before it is ever used.

There are a couple of other cases like this.  There are also 
initializations of unsigned variables to -1, which seem prevalent 
enough that perhaps they serve some purpose.

julia

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux