[LinuxBIOS] Fwd: Re: smbus_write_byte

Myles Watson myles at pel.cs.byu.edu
Tue Aug 21 21:18:13 CEST 2007



> > Oh, then I would have to switch it up a bit. This should work ok right?
> > ---------------------
> > static int spd_read_byte(unsigned device, unsigned address)
> > {
> >     int i;
> >
> >     if (device == 0x50){
> >         return do_smbus_read_byte(device, address);
> >     } else if (device == 0x51){
> >         for (i=0; i < (sizeof spd_table/sizeof spd_table[0]); i++){
> >             if (spd_table[i].address == address){
> >                 return spd_table[i].data;
> >             }
> >         }
            return 0xFF; /* This line returns 0xFF when address not found */
> >     } else {
> >         return 0xFF; /* returns 0xFF on any failures */
> >     }
> > }

I think it's a good idea to have a return in every control path.
Myles







More information about the coreboot mailing list