From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Mon, 5 Dec 2011 15:38:45 -0700 Subject: [U-Boot] [U-Boot, v2, 5/6] da850: add support to read mac address from spi flash In-Reply-To: <1318066118-20152-6-git-send-email-manjunath.hadli@ti.com> References: <1318066118-20152-6-git-send-email-manjunath.hadli@ti.com> Message-ID: <4EDD47F5.1040106@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 01/-10/-28163 12:59 PM, Hadli wrote: > From: Manjunath Hadli > > add support to read mac address from spi flash if env variable > is not set. This is supported only on L138 boards based on da850 > SOC. Introduced a macro CONFIG_MAC_ADDR_IN_SPIFLASH indicating > where to look mac address for. > > Signed-off-by: Manjunathappa, Prakash > Signed-off-by: Manjunath Hadli Sorry for the very late reply. gmail ate this email on me it seems. [snip] > +static int get_mac_addr(u8 *addr) > +{ > + struct spi_flash *flash; > + int ret; > + > + > + flash = spi_flash_probe(CFG_MAC_ADDR_SPI_BUS, CFG_MAC_ADDR_SPI_CS, > + CFG_MAC_ADDR_SPI_MAX_HZ, CFG_MAC_ADDR_SPI_MODE); > + if (!flash) { > + printf(" Error - unable to probe SPI flash.\n"); Leading space in the printf. > + ret = -1; > + goto err_probe; > + } > + > + ret = spi_flash_read(flash, CFG_MAC_ADDR_OFFSET, 6, addr); > + if (ret) { > + printf("Error - unable to read MAC address from SPI flash.\n"); > + goto err_read; > + } > + > +err_read: > + /* cannot call free currently since the free function calls free() for > + * spi_flash structure though it is not directly allocated through > + * malloc() > + */ > +err_probe: > + return ret; > +} We never called malloc() so it doesn't make sense to comment about not being able to call free() here. In fact, we should just do a 'return -1' after the printf here. > +#endif > + > void dsp_lpsc_on(unsigned domain, unsigned int id) > { > dv_reg_p mdstat, mdctl, ptstat, ptcmd; > @@ -220,7 +261,25 @@ static void dspwake(void) > > int misc_init_r(void) > { > + uchar buff[8]; > + int ret; Potential unused variable warnings here. -- Tom