Changeset 1413 for trunk


Ignore:
Timestamp:
08/15/11 21:54:20 (9 months ago)
Author:
hailfinger
Message:

Fixup of r1397:

  • Mixing uninitialized and initialized local variables leads to confusion.
  • ft2232_spi error cases should have gotten some error handling, and that's the reason the curly braces were there.
  • Fixing typos/wording in some places would have been nice given that those places were touched anyway.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
Acked-by: Stefan Tauner <stefan.tauner@…>

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/board_enable.c

    r1411 r1413  
    861861        } 
    862862 
    863         /* First, check the ISA bridge */ 
     863        /* Check for the ISA bridge first. */ 
    864864        dev = pci_dev_find_vendorclass(0x10DE, 0x0601); 
    865865        switch (dev->device_id) { 
     
    11301130        uint32_t tmp, base; 
    11311131 
    1132         /* GPPO {0,8,27,28,30} are always available */ 
    1133         static const uint32_t nonmuxed_gpos  = 0x58000101; 
     1132        /* GPO{0,8,27,28,30} are always available. */ 
     1133        static const uint32_t nonmuxed_gpos = 0x58000101; 
    11341134 
    11351135        static const struct {unsigned int reg, mask, value; } piix4_gpo[] = { 
     
    11801180 
    11811181        if ((((1 << gpo) & nonmuxed_gpos) == 0) && 
    1182              (pci_read_word(dev, piix4_gpo[gpo].reg) 
    1183              & piix4_gpo[gpo].mask) != piix4_gpo[gpo].value) { 
    1184                 msg_perr("\nERROR: PIIX4 GPO%d not programmed for output.\n", 
    1185                          gpo); 
     1182            ((pci_read_word(dev, piix4_gpo[gpo].reg) & piix4_gpo[gpo].mask) != 
     1183             piix4_gpo[gpo].value)) { 
     1184                msg_perr("\nERROR: PIIX4 GPO%d not programmed for output.\n", gpo); 
    11861185                return -1; 
    11871186        } 
  • trunk/buspirate_spi.c

    r1397 r1413  
    151151{ 
    152152        unsigned char buf[512]; 
    153         int ret = 0, i, spispeed = 0x7; 
    154153        char *dev = NULL; 
    155154        char *speed = NULL; 
     155        int spispeed = 0x7; 
     156        int ret = 0; 
     157        int i; 
    156158 
    157159        dev = extract_programmer_param("dev"); 
  • trunk/chipset_enable.c

    r1408 r1413  
    310310{ 
    311311        uint32_t fwh_conf; 
     312        int i, tmp; 
    312313        char *idsel = NULL; 
    313         int i, tmp, max_decode_fwh_idsel = 0, max_decode_fwh_decode = 0; 
     314        int max_decode_fwh_idsel = 0, max_decode_fwh_decode = 0; 
    314315        int contiguous = 1; 
    315316 
     
    10361037        } else { 
    10371038                msg_pinfo("AMD Elan SC520 detected, but no BOOTCS. " 
    1038                           "Assuming flash at 4G\n"); 
     1039                          "Assuming flash at 4G.\n"); 
    10391040        } 
    10401041 
  • trunk/cli_classic.c

    r1397 r1413  
    105105        struct flashchip *fill_flash; 
    106106        const char *name; 
    107         int startchip = 0, chipcount = 0, namelen, opt, option_index = 0; 
     107        int namelen, opt, i; 
     108        int startchip = 0, chipcount = 0, option_index = 0, force = 0; 
     109#if CONFIG_PRINT_WIKI == 1 
     110        int list_supported_wiki = 0; 
     111#endif 
    108112        int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0; 
    109         int dont_verify_it = 0, list_supported = 0, force = 0; 
    110 #if CONFIG_PRINT_WIKI == 1 
    111         int list_supported_wiki = 0; 
    112 #endif 
    113         int operation_specified = 0, i, ret = 0; 
     113        int dont_verify_it = 0, list_supported = 0, operation_specified = 0; 
     114        int ret = 0; 
    114115 
    115116        static const char optstring[] = "r:Rw:v:nVEfc:m:l:i:p:Lzh"; 
  • trunk/dediprog.c

    r1397 r1413  
    497497{ 
    498498        char *tmp = NULL; 
    499         int i, millivolt, fraction = 0; 
     499        int i; 
     500        int millivolt = 0, fraction = 0; 
    500501 
    501502        if (!voltage || !strlen(voltage)) { 
     
    575576        struct usb_device *dev; 
    576577        char *voltage; 
    577         int millivolt = 3500, ret; 
     578        int millivolt = 3500; 
     579        int ret; 
    578580 
    579581        msg_pspew("%s\n", __func__); 
  • trunk/dmi.c

    r1397 r1413  
    197197static int dmi_compare(const char *value, const char *pattern) 
    198198{ 
    199         int anchored = 0, patternlen; 
     199        int anchored = 0; 
     200        int patternlen; 
    200201 
    201202        msg_pspew("matching %s against %s\n", value, pattern); 
  • trunk/flashrom.c

    r1397 r1413  
    601601        /* Flash registers live 4 MByte below the flash. */ 
    602602        /* FIXME: This is incorrect for nonstandard flashbase. */ 
    603         flash->virtual_registers = (chipaddr)programmer_map_flash_region( 
    604             "flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size); 
     603        flash->virtual_registers = (chipaddr)programmer_map_flash_region("flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size); 
    605604} 
    606605 
     
    754753                 const char *message) 
    755754{ 
    756         int i, ret = 0, failcount = 0; 
     755        int i; 
    757756        uint8_t *readbuf = malloc(len); 
     757        int ret = 0, failcount = 0; 
    758758 
    759759        if (!len) 
     
    833833int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran) 
    834834{ 
    835         int result = 0, i, j, limit; 
     835        int result = 0; 
     836        int i, j, limit; 
    836837 
    837838        switch (gran) { 
     
    899900                          int *first_start, enum write_granularity gran) 
    900901{ 
    901         int need_write = 0, rel_start = 0, first_len = 0, i, limit, stride; 
     902        int need_write = 0, rel_start = 0, first_len = 0; 
     903        int i, limit, stride; 
    902904 
    903905        switch (gran) { 
     
    13271329static int selfcheck_eraseblocks(const struct flashchip *flash) 
    13281330{ 
    1329         int i, j, k, ret = 0; 
     1331        int i, j, k; 
     1332        int ret = 0; 
    13301333 
    13311334        for (k = 0; k < NUM_ERASEFUNCTIONS; k++) { 
     
    14521455{ 
    14531456        int i, j; 
    1454         unsigned int start = 0, len; 
     1457        unsigned int start = 0; 
     1458        unsigned int len; 
    14551459        struct block_eraser eraser = flash->block_erasers[erasefunction]; 
    14561460 
     
    16041608{ 
    16051609        const char *pname; 
    1606         int pnamelen, remaining = 0, firstline = 1, i; 
     1610        int pnamelen; 
     1611        int remaining = 0, firstline = 1; 
    16071612        enum programmer p; 
     1613        int i; 
    16081614 
    16091615        for (p = 0; p < PROGRAMMER_INVALID; p++) { 
  • trunk/ft2232_spi.c

    r1412 r1413  
    253253        } 
    254254 
    255         if (ftdi_usb_reset(ftdic) < 0) 
     255        if (ftdi_usb_reset(ftdic) < 0) { 
    256256                msg_perr("Unable to reset FTDI device\n"); 
    257  
    258         if (ftdi_set_latency_timer(ftdic, 2) < 0) 
     257        } 
     258 
     259        if (ftdi_set_latency_timer(ftdic, 2) < 0) { 
    259260                msg_perr("Unable to set latency timer\n"); 
    260  
    261         if (ftdi_write_data_set_chunksize(ftdic, 256)) 
     261        } 
     262 
     263        if (ftdi_write_data_set_chunksize(ftdic, 256)) { 
    262264                msg_perr("Unable to set chunk size\n"); 
    263  
    264         if (ftdi_set_bitmode(ftdic, 0x00, BITMODE_BITBANG_SPI) < 0) 
     265        } 
     266 
     267        if (ftdi_set_bitmode(ftdic, 0x00, BITMODE_BITBANG_SPI) < 0) { 
    265268                msg_perr("Unable to set bitmode to SPI\n"); 
     269        } 
    266270 
    267271        if (clock_5x) { 
     
    330334        static unsigned char *buf = NULL; 
    331335        /* failed is special. We use bitwise ops, but it is essentially bool. */ 
    332         int i = 0, ret = 0, failed = 0, bufsize; 
     336        int i = 0, ret = 0, failed = 0; 
     337        int bufsize; 
    333338        static int oldbufsize = 0; 
    334339 
  • trunk/it85spi.c

    r1401 r1413  
    8585 
    8686/* This function will poll the keyboard status register until either 
    87  *   an expected value shows up, or 
    88  *   timeout reaches. 
    89  * 
    90  * Returns: 0 -- the expected value has shown. 
    91  *          1 -- timeout reached. 
     87 * an expected value shows up, or the timeout is reached. 
     88 * timeout is in usec. 
     89 * 
     90 * Returns: 0 -- the expected value showed up. 
     91 *          1 -- timeout. 
    9292 */ 
    9393static int wait_for(const unsigned int mask, const unsigned int expected_value, 
    94                 const int timeout /* in usec */, const char *error_message, 
    95                 const char *function_name, const int lineno) 
     94                    const int timeout, const char * error_message, 
     95                    const char * function_name, const int lineno) 
    9696{ 
    9797        int time_passed; 
     
    318318 
    319319        it85xx_enter_scratch_rom(); 
    320         /* exit scratch ROM ONLY when programmer shuts down. Otherwise, the 
    321          * temporary flash state may halt EC. */ 
     320        /* Exit scratch ROM ONLY when programmer shuts down. Otherwise, the 
     321         * temporary flash state may halt the EC. 
     322         */ 
    322323 
    323324#ifdef LPC_IO 
  • trunk/it87spi.c

    r1397 r1413  
    204204int init_superio_ite(void) 
    205205{ 
    206         int i, ret = 0; 
     206        int i; 
     207        int ret = 0; 
    207208 
    208209        for (i = 0; i < superio_count; i++) { 
  • trunk/physmap.c

    r1397 r1413  
    7777        mi.address = phys_addr; 
    7878        mi.size = len; 
    79         ret = __dpmi_physical_address_mapping (&mi); 
     79        ret = __dpmi_physical_address_mapping(&mi); 
    8080 
    8181        if (ret != 0) 
Note: See TracChangeset for help on using the changeset viewer.