@@ -44,9 +44,5 @@ int clk_bsc_enable(void *base)
if (ret)
return ret;
- ret = clk_get_and_enable(bscstr);
- if (ret)
- return ret;
-
- return 0;
+ return clk_get_and_enable(bscstr);
}
@@ -44,9 +44,5 @@ int clk_bsc_enable(void *base)
if (ret)
return ret;
- ret = clk_get_and_enable(bscstr);
- if (ret)
- return ret;
-
- return 0;
+ return clk_get_and_enable(bscstr);
}
@@ -869,7 +869,7 @@ static int conv_of_platdata(struct udevice *dev)
{
struct rk3288_sdram_params *plat = dev_get_platdata(dev);
struct dtd_rockchip_rk3288_dmc *of_plat = &plat->of_plat;
- int i, ret;
+ int i;
for (i = 0; i < 2; i++) {
memcpy(&plat->ch[i], of_plat->rockchip_sdram_channel,
@@ -881,13 +881,10 @@ static int conv_of_platdata(struct udevice *dev)
sizeof(plat->phy_timing));
memcpy(&plat->base, of_plat->rockchip_sdram_params, sizeof(plat->base));
plat->num_channels = of_plat->rockchip_num_channels;
- ret = regmap_init_mem_platdata(dev, of_plat->reg,
- ARRAY_SIZE(of_plat->reg) / 2,
- &plat->map);
- if (ret)
- return ret;
- return 0;
+ return regmap_init_mem_platdata(dev, of_plat->reg,
+ ARRAY_SIZE(of_plat->reg) / 2,
+ &plat->map);
}
#endif
@@ -246,11 +246,7 @@ static int umc_ch_init(void __iomem *umc_ch_base, void __iomem *phy_ch_base,
if (ret)
return ret;
- ret = ddrphy_training(phy_base);
- if (ret)
- return ret;
-
- return 0;
+ return ddrphy_training(phy_base);
}
static void um_init(void __iomem *um_base)
@@ -220,11 +220,7 @@ static int boot_body_linux(bootm_headers_t *images)
if (ret)
return ret;
- ret = image_setup_linux(images);
- if (ret)
- return ret;
-
- return 0;
+ return image_setup_linux(images);
}
noinline
@@ -25,15 +25,9 @@ int cpu_mmc_init(bd_t *bis)
#ifndef CONFIG_EFI_APP
int arch_cpu_init(void)
{
- int ret;
-
post_code(POST_CPU_INIT);
- ret = x86_cpu_init_f();
- if (ret)
- return ret;
-
- return 0;
+ return x86_cpu_init_f();
}
int arch_misc_init(void)
@@ -93,11 +93,7 @@ int arch_cpu_init_dm(void)
return ret;
if (!dev)
return -ENODEV;
- ret = cpu_set_flex_ratio_to_tdp_nominal();
- if (ret)
- return ret;
-
- return 0;
+ return cpu_set_flex_ratio_to_tdp_nominal();
}
void set_max_freq(void)
@@ -213,7 +213,6 @@ static int broadwell_sata_enable(struct udevice *dev)
struct sata_platdata *plat = dev_get_platdata(dev);
struct gpio_desc desc;
u16 map;
- int ret;
/*
* Set SATA controller mode early so the resource allocator can
@@ -224,11 +223,7 @@ static int broadwell_sata_enable(struct udevice *dev)
map |= (plat->port_map ^ 0x3f) << 8;
dm_pci_write_config16(dev, 0x90, map);
- ret = gpio_request_by_name(dev, "reset-gpio", 0, &desc, GPIOD_IS_OUT);
- if (ret)
- return ret;
-
- return 0;
+ return gpio_request_by_name(dev, "reset-gpio", 0, &desc, GPIOD_IS_OUT);
}
static int broadwell_sata_ofdata_to_platdata(struct udevice *dev)
@@ -167,11 +167,7 @@ static int bd82x6x_probe(struct udevice *dev)
ret = syscon_get_by_driver_data(X86_SYSCON_GMA, &gma_dev);
if (ret)
return ret;
- ret = gma_func0_init(gma_dev);
- if (ret)
- return ret;
-
- return 0;
+ return gma_func0_init(gma_dev);
}
#endif /* CONFIG_HAVE_FSP */
@@ -76,11 +76,7 @@ int arch_cpu_init_dm(void)
* up. Perhaps this should move to later. Our next lot of init
* happens in print_cpuinfo() when we have a console
*/
- ret = set_flex_ratio_to_tdp_nominal();
- if (ret)
- return ret;
-
- return 0;
+ return set_flex_ratio_to_tdp_nominal();
}
#define PCH_EHCI0_TEMP_BAR0 0xe8000000
@@ -842,9 +842,5 @@ int gma_func0_init(struct udevice *dev)
debug("BIOS ran in %lums\n", get_timer(start));
#endif
/* Post VBIOS init */
- ret = gma_pm_init_post_vbios(dev, rev, gtt_bar);
- if (ret)
- return ret;
-
- return 0;
+ return gma_pm_init_post_vbios(dev, rev, gtt_bar);
}
@@ -10,13 +10,7 @@
int arch_cpu_init(void)
{
- int ret;
-
post_code(POST_CPU_INIT);
- ret = x86_cpu_init_f();
- if (ret)
- return ret;
-
- return 0;
+ return x86_cpu_init_f();
}
@@ -139,15 +139,9 @@ static void qemu_chipset_init(void)
int arch_cpu_init(void)
{
- int ret;
-
post_code(POST_CPU_INIT);
- ret = x86_cpu_init_f();
- if (ret)
- return ret;
-
- return 0;
+ return x86_cpu_init_f();
}
#ifndef CONFIG_EFI_STUB
@@ -85,24 +85,14 @@ static int __maybe_unused disable_igd(void)
ret = device_remove(sdvo);
if (ret)
return ret;
- ret = device_unbind(sdvo);
- if (ret)
- return ret;
-
- return 0;
+ return device_unbind(sdvo);
}
int arch_cpu_init(void)
{
- int ret;
-
post_code(POST_CPU_INIT);
- ret = x86_cpu_init_f();
- if (ret)
- return ret;
-
- return 0;
+ return x86_cpu_init_f();
}
int arch_early_init_r(void)
@@ -198,11 +198,7 @@ static int cm_fx6_setup_issd(void)
return ret;
}
- ret = gpio_request(CM_FX6_SATA_PWLOSS_INT, "sata_pwloss_int");
- if (ret)
- return ret;
-
- return 0;
+ return gpio_request(CM_FX6_SATA_PWLOSS_INT, "sata_pwloss_int");
}
#define CM_FX6_SATA_INIT_RETRIES 10
@@ -575,11 +575,7 @@ static int calc_esbchdr_esbc_hash(struct fsl_secboot_img_priv *img)
return ret;
/* Copy hash at destination buffer */
- ret = algo->hash_finish(algo, ctx, hash_val, algo->digest_size);
- if (ret)
- return ret;
-
- return 0;
+ return algo->hash_finish(algo, ctx, hash_val, algo->digest_size);
}
/*
@@ -161,14 +161,9 @@ static int port_exp_direction_output(unsigned gpio, int value)
if (ret)
return ret;
- ret = pca953x_set_val(PORTEXP_IO_TO_CHIP(gpio),
- (1 << PORTEXP_IO_TO_PIN(gpio)),
- (value << PORTEXP_IO_TO_PIN(gpio)));
-
- if (ret)
- return ret;
-
- return 0;
+ return pca953x_set_val(PORTEXP_IO_TO_CHIP(gpio),
+ 1 << PORTEXP_IO_TO_PIN(gpio),
+ value << PORTEXP_IO_TO_PIN(gpio));
}
static iomux_v3_cfg_t const eimnor_pads[] = {
@@ -94,14 +94,9 @@ static int port_exp_direction_output(unsigned gpio, int value)
if (ret)
return ret;
- ret = pca953x_set_val(PORTEXP_IO_TO_CHIP(gpio),
- (1 << PORTEXP_IO_TO_PIN(gpio)),
- (value << PORTEXP_IO_TO_PIN(gpio)));
-
- if (ret)
- return ret;
-
- return 0;
+ return pca953x_set_val(PORTEXP_IO_TO_CHIP(gpio),
+ 1 << PORTEXP_IO_TO_PIN(gpio),
+ value << PORTEXP_IO_TO_PIN(gpio));
}
int dram_init(void)
@@ -238,11 +238,7 @@ int fpga_reset(void)
/* small delay for the pulse */
udelay(10);
- ret = boco_set_bits(PRST1, resets);
- if (ret)
- return ret;
-
- return 0;
+ return boco_set_bits(PRST1, resets);
}
#endif
@@ -250,16 +246,10 @@ int fpga_reset(void)
* is available from the Bobcat SPI bus */
int toggle_eeprom_spi_bus(void)
{
- int ret = 0;
-
if (!check_boco2()) {
/* we do not have BOCO2, this is not really used */
return 0;
}
- ret = boco_set_bits(SPI_REG, CFG_EEPROM);
- if (ret)
- return ret;
-
- return 0;
+ return boco_set_bits(SPI_REG, CFG_EEPROM);
}
@@ -91,11 +91,7 @@ int drv_keyboard_init(void)
input_add_tables(&button_input, false);
button_input.read_keys = novena_gpio_button_read_keys;
- error = input_stdio_register(&dev);
- if (error)
- return error;
-
- return 0;
+ return input_stdio_register(&dev);
}
#endif
@@ -45,17 +45,11 @@ void i2c_init_board(void)
int power_init_board(void)
{
- int ret;
-
/*
* For PMIC the I2C bus is named as I2C5, but it is connected
* to logical I2C adapter 0
*/
- ret = pmic_init(I2C_0);
- if (ret)
- return ret;
-
- return 0;
+ return pmic_init(I2C_0);
}
int dram_init(void)
@@ -109,11 +109,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
if (hdr_read != header)
return -1;
- rc = i2c_read(dev_addr, 0x0, byte, ep, size);
- if (rc)
- return rc;
-
- return 0;
+ return i2c_read(dev_addr, 0x0, byte, ep, size);
}
int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr)
@@ -194,11 +194,7 @@ int adc_channel_single_shot(const char *name, int channel, unsigned int *data)
if (ret)
return ret;
- ret = adc_channel_data(dev, channel, data);
- if (ret)
- return ret;
-
- return 0;
+ return adc_channel_data(dev, channel, data);
}
static int _adc_channels_single_shot(struct udevice *dev,
@@ -243,11 +239,7 @@ int adc_channels_single_shot(const char *name, unsigned int channel_mask,
if (ret)
goto try_manual;
- ret = adc_channels_data(dev, channel_mask, channels);
- if (ret)
- return ret;
-
- return 0;
+ return adc_channels_data(dev, channel_mask, channels);
try_manual:
if (ret != -ENOSYS)
@@ -160,11 +160,7 @@ int dm_init(void)
#if CONFIG_IS_ENABLED(OF_CONTROL)
DM_ROOT_NON_CONST->of_offset = 0;
#endif
- ret = device_probe(DM_ROOT_NON_CONST);
- if (ret)
- return ret;
-
- return 0;
+ return device_probe(DM_ROOT_NON_CONST);
}
int dm_uninit(void)
@@ -261,11 +257,7 @@ int dm_init_and_scan(bool pre_reloc_only)
}
}
- ret = dm_scan_other(pre_reloc_only);
- if (ret)
- return ret;
-
- return 0;
+ return dm_scan_other(pre_reloc_only);
}
/* This is the root driver - all drivers are children of this */
@@ -40,12 +40,8 @@ static int dfu_write_medium_sf(struct dfu_entity *dfu,
if (ret)
return ret;
- ret = spi_flash_write(dfu->data.sf.dev, dfu->data.sf.start + offset,
- *len, buf);
- if (ret)
- return ret;
-
- return 0;
+ return spi_flash_write(dfu->data.sf.dev, dfu->data.sf.start + offset,
+ *len, buf);
}
static int dfu_flush_medium_sf(struct dfu_entity *dfu)
@@ -75,18 +75,13 @@ static int gen_74x164_set_value(struct udevice *dev, unsigned offset,
struct gen_74x164_priv *priv = dev_get_priv(dev);
uint bank = priv->nregs - 1 - offset / 8;
uint pin = offset % 8;
- int ret;
if (value)
priv->buffer[bank] |= 1 << pin;
else
priv->buffer[bank] &= ~(1 << pin);
- ret = gen_74x164_write_conf(dev);
- if (ret)
- return ret;
-
- return 0;
+ return gen_74x164_write_conf(dev);
}
static int gen_74x164_direction_input(struct udevice *dev, unsigned offset)
@@ -172,9 +172,5 @@ int axp_gpio_init(void)
return ret;
/* There is no devicetree support for the axp yet, so bind directly */
- ret = device_bind_driver(dm_root(), "gpio_axp", "AXP-gpio", &dev);
- if (ret)
- return ret;
-
- return 0;
+ return device_bind_driver(dm_root(), "gpio_axp", "AXP-gpio", &dev);
}
@@ -896,11 +896,7 @@ int cros_ec_flash_update_rw(struct cros_ec_dev *dev,
return ret;
/* Write the image */
- ret = cros_ec_flash_write(dev, image, rw_offset, image_size);
- if (ret)
- return ret;
-
- return 0;
+ return cros_ec_flash_write(dev, image, rw_offset, image_size);
}
int cros_ec_read_vbnvcontext(struct cros_ec_dev *dev, uint8_t *block)
@@ -84,17 +84,12 @@ static int pca9551_led_set_state(int led, int state)
buf = (buf & ~mask) | ((state & 0x03) << shift);
- ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
- if (ret)
- return ret;
-
- return 0;
+ return i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
}
static int pca9551_led_set_blink_rate(int idx, struct pca9551_blink_rate rate)
{
unsigned int reg;
- int ret;
switch (idx) {
case 0:
@@ -108,11 +103,7 @@ static int pca9551_led_set_blink_rate(int idx, struct pca9551_blink_rate rate)
}
reg |= PCA9551_CTRL_AI;
- ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, (u8 *)&rate, 2);
- if (ret)
- return ret;
-
- return 0;
+ return i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, (u8 *)&rate, 2);
}
/*
@@ -128,11 +128,7 @@ static int tegra186_bpmp_bind(struct udevice *dev)
if (ret)
return ret;
- ret = dm_scan_fdt_dev(dev);
- if (ret)
- return ret;
-
- return 0;
+ return dm_scan_fdt_dev(dev);
}
static ulong tegra186_bpmp_get_shmem(struct udevice *dev, int index)
@@ -136,13 +136,8 @@ static int atmel_sdhci_probe(struct udevice *dev)
static int atmel_sdhci_bind(struct udevice *dev)
{
struct atmel_sdhci_plat *plat = dev_get_platdata(dev);
- int ret;
- ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
- if (ret)
- return ret;
-
- return 0;
+ return sdhci_bind(dev, &plat->mmc, &plat->cfg);
}
static const struct udevice_id atmel_sdhci_ids[] = {
@@ -305,11 +305,7 @@ dmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
}
}
- err = dmmc_check_status(regs, &mmcstatus, MMCST0_DATDNE, status_err);
- if (err)
- return err;
-
- return 0;
+ return dmmc_check_status(regs, &mmcstatus, MMCST0_DATDNE, status_err);
}
/* Initialize Davinci MMC controller */
@@ -284,13 +284,8 @@ static int exynos_dwmmc_probe(struct udevice *dev)
static int exynos_dwmmc_bind(struct udevice *dev)
{
struct exynos_mmc_plat *plat = dev_get_platdata(dev);
- int ret;
- ret = dwmci_bind(dev, &plat->mmc, &plat->cfg);
- if (ret)
- return ret;
-
- return 0;
+ return dwmci_bind(dev, &plat->mmc, &plat->cfg);
}
static const struct udevice_id exynos_dwmmc_ids[] = {
@@ -243,7 +243,6 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
struct udevice *mmc_dev = dev_get_parent(bdev);
struct mmc *mmc = mmc_get_mmc_dev(mmc_dev);
struct blk_desc *desc = dev_get_uclass_platdata(bdev);
- int ret;
if (desc->hwpart == hwpart)
return 0;
@@ -251,11 +250,7 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
if (mmc->part_config == MMCPART_NOAVAILABLE)
return -EMEDIUMTYPE;
- ret = mmc_switch_part(mmc, hwpart);
- if (ret)
- return ret;
-
- return 0;
+ return mmc_switch_part(mmc, hwpart);
}
static const struct blk_ops mmc_blk_ops = {
@@ -85,16 +85,10 @@ int mmc_boot_partition_size_change(struct mmc *mmc, unsigned long bootsize,
*/
int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode)
{
- int err;
-
- err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_BUS_WIDTH,
- EXT_CSD_BOOT_BUS_WIDTH_MODE(mode) |
- EXT_CSD_BOOT_BUS_WIDTH_RESET(reset) |
- EXT_CSD_BOOT_BUS_WIDTH_WIDTH(width));
-
- if (err)
- return err;
- return 0;
+ return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_BUS_WIDTH,
+ EXT_CSD_BOOT_BUS_WIDTH_MODE(mode) |
+ EXT_CSD_BOOT_BUS_WIDTH_RESET(reset) |
+ EXT_CSD_BOOT_BUS_WIDTH_WIDTH(width));
}
/*
@@ -106,16 +100,10 @@ int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode)
*/
int mmc_set_part_conf(struct mmc *mmc, u8 ack, u8 part_num, u8 access)
{
- int err;
-
- err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF,
- EXT_CSD_BOOT_ACK(ack) |
- EXT_CSD_BOOT_PART_NUM(part_num) |
- EXT_CSD_PARTITION_ACCESS(access));
-
- if (err)
- return err;
- return 0;
+ return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF,
+ EXT_CSD_BOOT_ACK(ack) |
+ EXT_CSD_BOOT_PART_NUM(part_num) |
+ EXT_CSD_PARTITION_ACCESS(access));
}
/*
@@ -161,7 +161,6 @@ void mmc_destroy(struct mmc *mmc)
static int mmc_select_hwpartp(struct blk_desc *desc, int hwpart)
{
struct mmc *mmc = find_mmc_device(desc->devnum);
- int ret;
if (!mmc)
return -ENODEV;
@@ -172,11 +171,7 @@ static int mmc_select_hwpartp(struct blk_desc *desc, int hwpart)
if (mmc->part_config == MMCPART_NOAVAILABLE)
return -EMEDIUMTYPE;
- ret = mmc_switch_part(mmc, hwpart);
- if (ret)
- return ret;
-
- return 0;
+ return mmc_switch_part(mmc, hwpart);
}
static int mmc_get_dev(int dev, struct blk_desc **descp)
@@ -190,13 +190,8 @@ static int msm_ofdata_to_platdata(struct udevice *dev)
static int msm_sdc_bind(struct udevice *dev)
{
struct msm_sdhc_plat *plat = dev_get_platdata(dev);
- int ret;
- ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
- if (ret)
- return ret;
-
- return 0;
+ return sdhci_bind(dev, &plat->mmc, &plat->cfg);
}
static const struct udevice_id msm_mmc_ids[] = {
@@ -331,11 +331,7 @@ static int mxcmci_push(struct mxcmci_host *host, const void *_buf, int bytes)
writel(tmp, &host->base->buffer_access);
}
- stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
- if (stat)
- return stat;
-
- return 0;
+ return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
}
static int mxcmci_transfer_data(struct mxcmci_host *host)
@@ -100,7 +100,6 @@ static int pxa_mmc_start_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
{
struct pxa_mmc_priv *priv = mmc->priv;
struct pxa_mmc_regs *regs = priv->regs;
- int ret;
/* The card can send a "busy" response */
if (cmd->resp_type & MMC_RSP_BUSY)
@@ -131,12 +130,7 @@ static int pxa_mmc_start_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
/* Start the controller clock and wait until they are started */
writel(MMC_STRPCL_START_CLK, ®s->strpcl);
- ret = pxa_mmc_wait(mmc, MMC_STAT_CLK_EN);
- if (ret)
- return ret;
-
- /* Correct and happy end */
- return 0;
+ return pxa_mmc_wait(mmc, MMC_STAT_CLK_EN);
}
static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
@@ -188,7 +182,6 @@ static int pxa_mmc_do_read_xfer(struct mmc *mmc, struct mmc_data *data)
uint32_t len;
uint32_t *buf = (uint32_t *)data->dest;
int size;
- int ret;
len = data->blocks * data->blocksize;
@@ -210,11 +203,7 @@ static int pxa_mmc_do_read_xfer(struct mmc *mmc, struct mmc_data *data)
}
/* Wait for the transmission-done interrupt */
- ret = pxa_mmc_wait(mmc, MMC_STAT_DATA_TRAN_DONE);
- if (ret)
- return ret;
-
- return 0;
+ return pxa_mmc_wait(mmc, MMC_STAT_DATA_TRAN_DONE);
}
static int pxa_mmc_do_write_xfer(struct mmc *mmc, struct mmc_data *data)
@@ -252,11 +241,7 @@ static int pxa_mmc_do_write_xfer(struct mmc *mmc, struct mmc_data *data)
return ret;
/* Wait until the data are really written to the card */
- ret = pxa_mmc_wait(mmc, MMC_STAT_PRG_DONE);
- if (ret)
- return ret;
-
- return 0;
+ return pxa_mmc_wait(mmc, MMC_STAT_PRG_DONE);
}
static int pxa_mmc_request(struct mmc *mmc, struct mmc_cmd *cmd,
@@ -142,13 +142,8 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
static int rockchip_dwmmc_bind(struct udevice *dev)
{
struct rockchip_mmc_plat *plat = dev_get_platdata(dev);
- int ret;
- ret = dwmci_bind(dev, &plat->mmc, &plat->cfg);
- if (ret)
- return ret;
-
- return 0;
+ return dwmci_bind(dev, &plat->mmc, &plat->cfg);
}
static const struct udevice_id rockchip_dwmmc_ids[] = {
@@ -62,13 +62,8 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
static int rockchip_sdhci_bind(struct udevice *dev)
{
struct rockchip_sdhc_plat *plat = dev_get_platdata(dev);
- int ret;
- ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
- if (ret)
- return ret;
-
- return 0;
+ return sdhci_bind(dev, &plat->mmc, &plat->cfg);
}
static const struct udevice_id arasan_sdhci_ids[] = {
@@ -112,7 +112,6 @@ int sandbox_mmc_bind(struct udevice *dev)
{
struct sandbox_mmc_plat *plat = dev_get_platdata(dev);
struct mmc_config *cfg = &plat->cfg;
- int ret;
cfg->name = dev->name;
cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT;
@@ -121,11 +120,7 @@ int sandbox_mmc_bind(struct udevice *dev)
cfg->f_max = 52000000;
cfg->b_max = U32_MAX;
- ret = mmc_bind(dev, &plat->mmc, cfg);
- if (ret)
- return ret;
-
- return 0;
+ return mmc_bind(dev, &plat->mmc, cfg);
}
int sandbox_mmc_unbind(struct udevice *dev)
@@ -63,13 +63,8 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
static int arasan_sdhci_bind(struct udevice *dev)
{
struct arasan_sdhci_plat *plat = dev_get_platdata(dev);
- int ret;
- ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
- if (ret)
- return ret;
-
- return 0;
+ return sdhci_bind(dev, &plat->mmc, &plat->cfg);
}
static const struct udevice_id arasan_sdhci_ids[] = {
@@ -788,11 +788,7 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr)
if (ret)
return ret;
- ret = nand_register(devnum, mtd);
- if (ret)
- return ret;
-
- return 0;
+ return nand_register(devnum, mtd);
}
#ifndef CONFIG_SYS_NAND_BASE_LIST
@@ -1044,10 +1044,7 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr)
if (ret)
return ret;
- ret = nand_register(devnum, mtd);
- if (ret)
- return ret;
- return 0;
+ return nand_register(devnum, mtd);
}
#ifndef CONFIG_SYS_NAND_BASE_LIST
@@ -975,11 +975,7 @@ int tegra_nand_init(struct nand_chip *nand, int devnum)
if (ret)
return ret;
- ret = nand_register(devnum, our_mtd);
- if (ret)
- return ret;
-
- return 0;
+ return nand_register(devnum, our_mtd);
}
void board_nand_init(void)
@@ -751,11 +751,7 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
if (err)
return err;
- err = nand_register(devnum, mtd);
- if (err)
- return err;
-
- return 0;
+ return nand_register(devnum, mtd);
error:
return err;
@@ -1002,11 +1002,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
ubi_msg(ubi, "\"delete\" compatible internal volume %d:%d found, will remove it",
vol_id, lnum);
}
- err = add_to_list(ai, pnum, vol_id, lnum,
- ec, 1, &ai->erase);
- if (err)
- return err;
- return 0;
+ return add_to_list(ai, pnum, vol_id, lnum, ec, 1,
+ &ai->erase);
case UBI_COMPAT_RO:
ubi_msg(ubi, "read-only compatible internal volume %d:%d found, switch to read-only mode",
@@ -1017,11 +1014,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
case UBI_COMPAT_PRESERVE:
ubi_msg(ubi, "\"preserve\" compatible internal volume %d:%d found",
vol_id, lnum);
- err = add_to_list(ai, pnum, vol_id, lnum,
- ec, 0, &ai->alien);
- if (err)
- return err;
- return 0;
+ return add_to_list(ai, pnum, vol_id, lnum, ec, 0,
+ &ai->alien);
case UBI_COMPAT_REJECT:
ubi_err(ubi, "incompatible internal volume %d:%d found",
@@ -368,11 +368,7 @@ static int fm_eth_init(struct fm_eth *fm_eth)
if (ret)
return ret;
- ret = fm_eth_tx_port_parameter_init(fm_eth);
- if (ret)
- return ret;
-
- return 0;
+ return fm_eth_tx_port_parameter_init(fm_eth);
}
static int fm_eth_startup(struct fm_eth *fm_eth)
@@ -1864,7 +1864,7 @@ static int mvpp2_prs_etype_init(struct mvpp2 *priv)
static int mvpp2_prs_default_init(struct udevice *dev,
struct mvpp2 *priv)
{
- int err, index, i;
+ int index, i;
/* Enable tcam table */
mvpp2_write(priv, MVPP2_PRS_TCAM_CTRL_REG, MVPP2_PRS_TCAM_EN_MASK);
@@ -1901,11 +1901,7 @@ static int mvpp2_prs_default_init(struct udevice *dev,
mvpp2_prs_mac_init(priv);
- err = mvpp2_prs_etype_init(priv);
- if (err)
- return err;
-
- return 0;
+ return mvpp2_prs_etype_init(priv);
}
/* Compare MAC DA with tcam entry data */
@@ -3460,7 +3456,7 @@ static int mvpp2_port_init(struct udevice *dev, struct mvpp2_port *port)
{
struct mvpp2 *priv = port->priv;
struct mvpp2_txq_pcpu *txq_pcpu;
- int queue, cpu, err;
+ int queue, cpu;
if (port->first_rxq + rxq_number > MVPP2_RXQ_TOTAL_NUM)
return -EINVAL;
@@ -3547,11 +3543,7 @@ static int mvpp2_port_init(struct udevice *dev, struct mvpp2_port *port)
port->pkt_size = MVPP2_RX_PKT_SIZE(PKTSIZE_ALIGN);
/* Initialize pools for swf */
- err = mvpp2_swf_bm_pool_init(port);
- if (err)
- return err;
-
- return 0;
+ return mvpp2_swf_bm_pool_init(port);
}
/* Ports initialization */
@@ -102,11 +102,7 @@ static int sw_reg_write(const char *devname, u8 phy_addr, u8 port,
if (ret)
return ret;
- ret = sw_wait_rdy(devname, phy_addr);
- if (ret)
- return ret;
-
- return 0;
+ return sw_wait_rdy(devname, phy_addr);
}
static int ppu_enable(const char *devname, u8 phy_addr)
@@ -555,7 +555,6 @@ static int emaclite_miiphy_write(struct mii_dev *bus, int addr, int devad,
static int emaclite_probe(struct udevice *dev)
{
struct xemaclite *emaclite = dev_get_priv(dev);
- int ret;
emaclite->bus = mdio_alloc();
emaclite->bus->read = emaclite_miiphy_read;
@@ -563,11 +562,7 @@ static int emaclite_probe(struct udevice *dev)
emaclite->bus->priv = emaclite;
strcpy(emaclite->bus->name, "emaclite");
- ret = mdio_register(emaclite->bus);
- if (ret)
- return ret;
-
- return 0;
+ return mdio_register(emaclite->bus);
}
static int emaclite_remove(struct udevice *dev)
@@ -131,11 +131,7 @@ static int pcie_phy_wait_ack(void __iomem *dbi_base, int addr)
val = addr << PCIE_PHY_CTRL_DATA_LOC;
writel(val, dbi_base + PCIE_PHY_CTRL);
- ret = pcie_phy_poll_ack(dbi_base, 0);
- if (ret)
- return ret;
-
- return 0;
+ return pcie_phy_poll_ack(dbi_base, 0);
}
/* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */
@@ -162,11 +158,7 @@ static int pcie_phy_read(void __iomem *dbi_base, int addr , int *data)
/* deassert Read signal */
writel(0x00, dbi_base + PCIE_PHY_CTRL);
- ret = pcie_phy_poll_ack(dbi_base, 0);
- if (ret)
- return ret;
-
- return 0;
+ return pcie_phy_poll_ack(dbi_base, 0);
}
static int pcie_phy_write(void __iomem *dbi_base, int addr, int data)
@@ -217,13 +217,7 @@ int axp_set_sw(bool on)
int axp_init(void)
{
- int ret;
-
- ret = pmic_bus_init();
- if (ret)
- return ret;
-
- return 0;
+ return pmic_bus_init();
}
int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -146,7 +146,6 @@ static int sandbox_i2c_rtc_complete_write(struct udevice *emul)
{
struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(emul);
struct rtc_time time;
- int ret;
time.tm_sec = plat->reg[REG_SEC];
time.tm_min = plat->reg[REG_MIN];
@@ -156,11 +155,7 @@ static int sandbox_i2c_rtc_complete_write(struct udevice *emul)
time.tm_year = plat->reg[REG_YEAR] + 1900;
time.tm_wday = plat->reg[REG_WDAY];
- ret = sandbox_i2c_rtc_set(emul, &time);
- if (ret)
- return ret;
-
- return 0;
+ return sandbox_i2c_rtc_set(emul, &time);
}
static int sandbox_i2c_rtc_xfer(struct udevice *emul, struct i2c_msg *msg,
@@ -202,11 +197,7 @@ static int sandbox_i2c_rtc_xfer(struct udevice *emul, struct i2c_msg *msg,
reset_time(emul);
}
}
- ret = sandbox_i2c_rtc_complete_write(emul);
- if (ret)
- return ret;
-
- return 0;
+ return sandbox_i2c_rtc_complete_write(emul);
}
struct dm_i2c_ops sandbox_i2c_rtc_emul_ops = {
@@ -130,13 +130,7 @@ static int ehci_atmel_probe(struct udevice *dev)
static int ehci_atmel_remove(struct udevice *dev)
{
- int ret;
-
- ret = ehci_deregister(dev);
- if (ret)
- return ret;
-
- return 0;
+ return ehci_deregister(dev);
}
static const struct udevice_id ehci_usb_ids[] = {
@@ -120,13 +120,7 @@ static int ehci_fsl_probe(struct udevice *dev)
static int ehci_fsl_remove(struct udevice *dev)
{
- int ret;
-
- ret = ehci_deregister(dev);
- if (ret)
- return ret;
-
- return 0;
+ return ehci_deregister(dev);
}
static const struct udevice_id ehci_usb_ids[] = {
@@ -96,13 +96,7 @@ static int ehci_mvebu_probe(struct udevice *dev)
static int ehci_mvebu_remove(struct udevice *dev)
{
- int ret;
-
- ret = ehci_deregister(dev);
- if (ret)
- return ret;
-
- return 0;
+ return ehci_deregister(dev);
}
static const struct udevice_id ehci_usb_ids[] = {
@@ -453,13 +453,7 @@ static int ehci_usb_probe(struct udevice *dev)
static int ehci_usb_remove(struct udevice *dev)
{
- int ret;
-
- ret = ehci_deregister(dev);
- if (ret)
- return ret;
-
- return 0;
+ return ehci_deregister(dev);
}
static const struct udevice_id mx6_usb_ids[] = {
@@ -128,13 +128,7 @@ static int ehci_pci_probe(struct udevice *dev)
static int ehci_pci_remove(struct udevice *dev)
{
- int ret;
-
- ret = ehci_deregister(dev);
- if (ret)
- return ret;
-
- return 0;
+ return ehci_deregister(dev);
}
static const struct udevice_id ehci_pci_ids[] = {
@@ -75,13 +75,7 @@ static int ehci_zynq_probe(struct udevice *dev)
static int ehci_zynq_remove(struct udevice *dev)
{
- int ret;
-
- ret = ehci_deregister(dev);
- if (ret)
- return ret;
-
- return 0;
+ return ehci_deregister(dev);
}
static const struct udevice_id ehci_zynq_ids[] = {
@@ -129,15 +129,10 @@ static int xhci_fsl_probe(struct udevice *dev)
static int xhci_fsl_remove(struct udevice *dev)
{
struct xhci_fsl_priv *priv = dev_get_priv(dev);
- int ret;
fsl_xhci_core_exit(&priv->ctx);
- ret = xhci_deregister(dev);
- if (ret)
- return ret;
-
- return 0;
+ return xhci_deregister(dev);
}
static const struct udevice_id xhci_usb_ids[] = {
@@ -129,11 +129,7 @@ int ulpi_set_vbus_indicator(struct ulpi_viewport *ulpi_vp, int external,
val = val & ~(ULPI_IFACE_PASSTHRU & ULPI_IFACE_EXTVBUS_COMPLEMENT);
val |= flags;
- val = ulpi_write(ulpi_vp, &ulpi->iface_ctrl, val);
- if (val)
- return val;
-
- return 0;
+ return ulpi_write(ulpi_vp, &ulpi->iface_ctrl, val);
}
int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable)
@@ -11,14 +11,8 @@
static int ptn3460_attach(struct udevice *dev)
{
- int ret;
-
debug("%s: %s\n", __func__, dev->name);
- ret = video_bridge_set_active(dev, true);
- if (ret)
- return ret;
-
- return 0;
+ return video_bridge_set_active(dev, true);
}
struct video_bridge_ops ptn3460_ops = {
@@ -768,11 +768,7 @@ static int rk_edp_set_link_train(struct rk_edp_priv *edp)
return ret;
}
- ret = rk_edp_hw_link_training(edp);
- if (ret)
- return ret;
-
- return 0;
+ return rk_edp_hw_link_training(edp);
}
static void rk_edp_init_video(struct rk3288_edp *regs)
@@ -23,14 +23,9 @@ struct simple_panel_priv {
static int simple_panel_enable_backlight(struct udevice *dev)
{
struct simple_panel_priv *priv = dev_get_priv(dev);
- int ret;
dm_gpio_set_value(&priv->enable, 1);
- ret = backlight_enable(priv->backlight);
- if (ret)
- return ret;
-
- return 0;
+ return backlight_enable(priv->backlight);
}
static int simple_panel_ofdata_to_platdata(struct udevice *dev)
@@ -326,13 +326,7 @@ static int display_update_config_from_edid(struct udevice *dp_dev,
int *panel_bppp,
struct display_timing *timing)
{
- int ret;
-
- ret = display_read_timing(dp_dev, timing);
- if (ret)
- return ret;
-
- return 0;
+ return display_read_timing(dp_dev, timing);
}
static int display_init(struct udevice *dev, void *lcdbase,
@@ -190,7 +190,6 @@ static int vidconsole_post_probe(struct udevice *dev)
{
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
struct stdio_dev *sdev = &priv->sdev;
- int ret;
if (!priv->tab_width_frac)
priv->tab_width_frac = VID_TO_POS(priv->x_charsize) * 8;
@@ -206,11 +205,7 @@ static int vidconsole_post_probe(struct udevice *dev)
sdev->putc = vidconsole_putc;
sdev->puts = vidconsole_puts;
sdev->priv = dev;
- ret = stdio_register(sdev);
- if (ret)
- return ret;
-
- return 0;
+ return stdio_register(sdev);
}
UCLASS_DRIVER(vidconsole) = {
@@ -71,7 +71,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write)
*/
static int run_gc(struct ubifs_info *c)
{
- int err, lnum;
+ int lnum;
/* Make some free space by garbage-collecting dirty space */
down_read(&c->commit_sem);
@@ -82,10 +82,7 @@ static int run_gc(struct ubifs_info *c)
/* GC freed one LEB, return it to lprops */
dbg_budg("GC freed LEB %d", lnum);
- err = ubifs_return_leb(c, lnum);
- if (err)
- return err;
- return 0;
+ return ubifs_return_leb(c, lnum);
}
/**
@@ -292,10 +292,7 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
err = dbg_check_data_nodes_order(c, &sleb->nodes);
if (err)
return err;
- err = dbg_check_nondata_nodes_order(c, nondata);
- if (err)
- return err;
- return 0;
+ return dbg_check_nondata_nodes_order(c, nondata);
}
/**
@@ -310,10 +310,7 @@ static int layout_cnodes(struct ubifs_info *c)
alen = ALIGN(offs, c->min_io_size);
upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
dbg_chk_lpt_sz(c, 4, alen - offs);
- err = dbg_chk_lpt_sz(c, 3, alen);
- if (err)
- return err;
- return 0;
+ return dbg_chk_lpt_sz(c, 3, alen);
no_space:
ubifs_err(c, "LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d",
@@ -247,11 +247,7 @@ int __init ubifs_compressors_init(void)
if (err)
return err;
- err = compr_init(&none_compr);
- if (err)
- return err;
-
- return 0;
+ return compr_init(&none_compr);
}
/*
@@ -148,17 +148,13 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
int fdt_del_mem_rsv(void *fdt, int n)
{
struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
- int err;
FDT_RW_CHECK_HEADER(fdt);
if (n >= fdt_num_mem_rsv(fdt))
return -FDT_ERR_NOTFOUND;
- err = _fdt_splice_mem_rsv(fdt, re, 1, 0);
- if (err)
- return err;
- return 0;
+ return _fdt_splice_mem_rsv(fdt, re, 1, 0);
}
static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
@@ -165,9 +165,5 @@ int hash_calculate(const char *name,
ret = algo->hash_update(algo, ctx, region[i].data, region[i].size, 1);
if (ret)
return ret;
- ret = algo->hash_finish(algo, ctx, checksum, algo->digest_size);
- if (ret)
- return ret;
-
- return 0;
+ return algo->hash_finish(algo, ctx, checksum, algo->digest_size);
}
@@ -390,7 +390,6 @@ uint32_t tpm_nv_write_value(uint32_t index, const void *data, uint32_t length)
TPM_REQUEST_HEADER_LENGTH + write_info_size + length;
uint8_t buf[COMMAND_BUFFER_SIZE], response[COMMAND_BUFFER_SIZE];
size_t response_length = sizeof(response);
- uint32_t err;
if (pack_byte_string(buf, sizeof(buf), "sddds",
0, command, sizeof(command),
@@ -399,11 +398,7 @@ uint32_t tpm_nv_write_value(uint32_t index, const void *data, uint32_t length)
length_offset, length,
data_offset, data, length))
return TPM_LIB_ERROR;
- err = tpm_sendrecv_command(buf, response, &response_length);
- if (err)
- return err;
-
- return 0;
+ return tpm_sendrecv_command(buf, response, &response_length);
}
uint32_t tpm_extend(uint32_t index, const void *in_digest, void *out_digest)
@@ -1605,11 +1605,7 @@ static int sb_build_tree_from_cfg(struct sb_image_ctx *ictx)
if (ret)
return ret;
- ret = sb_fixup_sections_and_tags(ictx);
- if (ret)
- return ret;
-
- return 0;
+ return sb_fixup_sections_and_tags(ictx);
}
static int sb_verify_image_header(struct sb_image_ctx *ictx,
-ret = expression; -if (ret) - return ret; -return 0; +return expression; Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- arch/arm/cpu/armv7/bcm235xx/clk-bsc.c | 6 +----- arch/arm/cpu/armv7/bcm281xx/clk-bsc.c | 6 +----- arch/arm/mach-rockchip/rk3288/sdram_rk3288.c | 11 ++++------ arch/arm/mach-uniphier/dram/umc-ld20.c | 6 +----- arch/powerpc/lib/bootm.c | 6 +----- arch/x86/cpu/baytrail/valleyview.c | 8 +------ arch/x86/cpu/broadwell/cpu.c | 6 +----- arch/x86/cpu/broadwell/sata.c | 7 +------ arch/x86/cpu/ivybridge/bd82x6x.c | 6 +----- arch/x86/cpu/ivybridge/cpu.c | 6 +----- arch/x86/cpu/ivybridge/gma.c | 6 +----- arch/x86/cpu/ivybridge/ivybridge.c | 8 +------ arch/x86/cpu/qemu/qemu.c | 8 +------ arch/x86/cpu/queensbay/tnc.c | 14 ++----------- board/compulab/cm_fx6/cm_fx6.c | 6 +----- board/freescale/common/fsl_validate.c | 6 +----- board/freescale/mx6qsabreauto/mx6qsabreauto.c | 11 +++------- board/freescale/mx6sxsabreauto/mx6sxsabreauto.c | 11 +++------- board/keymile/km_arm/fpga_config.c | 14 ++----------- board/kosagi/novena/novena.c | 6 +----- board/samsung/goni/goni.c | 8 +------ board/ti/common/board_detect.c | 6 +----- drivers/adc/adc-uclass.c | 12 ++--------- drivers/core/root.c | 12 ++--------- drivers/dfu/dfu_sf.c | 8 ++----- drivers/gpio/74x164_gpio.c | 7 +------ drivers/gpio/axp_gpio.c | 6 +----- drivers/misc/cros_ec.c | 6 +----- drivers/misc/pca9551_led.c | 13 ++---------- drivers/misc/tegra186_bpmp.c | 6 +----- drivers/mmc/atmel_sdhci.c | 7 +------ drivers/mmc/davinci_mmc.c | 6 +----- drivers/mmc/exynos_dw_mmc.c | 7 +------ drivers/mmc/mmc-uclass.c | 7 +------ drivers/mmc/mmc_boot.c | 28 +++++++------------------ drivers/mmc/mmc_legacy.c | 7 +------ drivers/mmc/msm_sdhci.c | 7 +------ drivers/mmc/mxcmmc.c | 6 +----- drivers/mmc/pxa_mmc_gen.c | 21 +++---------------- drivers/mmc/rockchip_dw_mmc.c | 7 +------ drivers/mmc/rockchip_sdhci.c | 7 +------ drivers/mmc/sandbox_mmc.c | 7 +------ drivers/mmc/zynq_sdhci.c | 7 +------ drivers/mtd/nand/fsl_elbc_nand.c | 6 +----- drivers/mtd/nand/fsl_ifc_nand.c | 5 +---- drivers/mtd/nand/tegra_nand.c | 6 +----- drivers/mtd/nand/vf610_nfc.c | 6 +----- drivers/mtd/ubi/attach.c | 14 ++++--------- drivers/net/fm/eth.c | 6 +----- drivers/net/mvpp2.c | 16 ++++---------- drivers/net/phy/mv88e6352.c | 6 +----- drivers/net/xilinx_emaclite.c | 7 +------ drivers/pci/pcie_imx.c | 12 ++--------- drivers/power/axp809.c | 8 +------ drivers/rtc/i2c_rtc_emul.c | 13 ++---------- drivers/usb/host/ehci-atmel.c | 8 +------ drivers/usb/host/ehci-fsl.c | 8 +------ drivers/usb/host/ehci-marvell.c | 8 +------ drivers/usb/host/ehci-mx6.c | 8 +------ drivers/usb/host/ehci-pci.c | 8 +------ drivers/usb/host/ehci-zynq.c | 8 +------ drivers/usb/host/xhci-fsl.c | 7 +------ drivers/usb/ulpi/ulpi.c | 6 +----- drivers/video/bridge/ptn3460.c | 8 +------ drivers/video/rockchip/rk_edp.c | 6 +----- drivers/video/simple_panel.c | 7 +------ drivers/video/tegra124/display.c | 8 +------ drivers/video/vidconsole-uclass.c | 7 +------ fs/ubifs/budget.c | 7 ++----- fs/ubifs/gc.c | 5 +---- fs/ubifs/lpt_commit.c | 5 +---- fs/ubifs/ubifs.c | 6 +----- lib/libfdt/fdt_rw.c | 6 +----- lib/rsa/rsa-checksum.c | 6 +----- lib/tpm.c | 7 +------ tools/mxsimage.c | 6 +----- 76 files changed, 107 insertions(+), 509 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot