Re: [PATCH 5/8] mfd: rtsx: Simplify function return logic

From: Lee Jones
Date: Thu Oct 01 2015 - 03:20:07 EST


On Tue, 29 Sep 2015, Javier Martinez Canillas wrote:

> The invoked functions already return zero on success or a negative
> errno code so there is no need to open code the logic in the caller.
>
> Signed-off-by: Javier Martinez Canillas <javier@xxxxxxxxxxxxxxx>
> ---
>
> drivers/mfd/rts5209.c | 6 +-----
> drivers/mfd/rts5227.c | 6 +-----
> drivers/mfd/rts5229.c | 6 +-----
> drivers/mfd/rts5249.c | 6 +-----
> drivers/mfd/rtsx_pcr.c | 6 +-----
> 5 files changed, 5 insertions(+), 25 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
> index 373e253c33df..b95beecf767f 100644
> --- a/drivers/mfd/rts5209.c
> +++ b/drivers/mfd/rts5209.c
> @@ -138,11 +138,7 @@ static int rts5209_card_power_on(struct rtsx_pcr *pcr, int card)
> rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, pwr_mask, pwr_on);
> rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
> LDO3318_PWR_MASK, 0x00);
> - err = rtsx_pci_send_cmd(pcr, 100);
> - if (err < 0)
> - return err;
> -
> - return 0;
> + return rtsx_pci_send_cmd(pcr, 100);
> }
>
> static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card)
> diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
> index ce012d78ce2a..c5a65298c781 100644
> --- a/drivers/mfd/rts5227.c
> +++ b/drivers/mfd/rts5227.c
> @@ -179,11 +179,7 @@ static int rts5227_card_power_on(struct rtsx_pcr *pcr, int card)
> SD_POWER_MASK, SD_POWER_ON);
> rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
> LDO3318_PWR_MASK, 0x06);
> - err = rtsx_pci_send_cmd(pcr, 100);
> - if (err < 0)
> - return err;
> -
> - return 0;
> + return rtsx_pci_send_cmd(pcr, 100);
> }
>
> static int rts5227_card_power_off(struct rtsx_pcr *pcr, int card)
> diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
> index ace45384ec8b..9ed9dc84eac8 100644
> --- a/drivers/mfd/rts5229.c
> +++ b/drivers/mfd/rts5229.c
> @@ -129,11 +129,7 @@ static int rts5229_card_power_on(struct rtsx_pcr *pcr, int card)
> SD_POWER_MASK, SD_POWER_ON);
> rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
> LDO3318_PWR_MASK, 0x06);
> - err = rtsx_pci_send_cmd(pcr, 100);
> - if (err < 0)
> - return err;
> -
> - return 0;
> + return rtsx_pci_send_cmd(pcr, 100);
> }
>
> static int rts5229_card_power_off(struct rtsx_pcr *pcr, int card)
> diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
> index eb2d5866f719..40f8bb14fc59 100644
> --- a/drivers/mfd/rts5249.c
> +++ b/drivers/mfd/rts5249.c
> @@ -234,11 +234,7 @@ static int rtsx_base_card_power_on(struct rtsx_pcr *pcr, int card)
> SD_POWER_MASK, SD_VCC_POWER_ON);
> rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
> LDO3318_PWR_MASK, 0x06);
> - err = rtsx_pci_send_cmd(pcr, 100);
> - if (err < 0)
> - return err;
> -
> - return 0;
> + return rtsx_pci_send_cmd(pcr, 100);
> }
>
> static int rtsx_base_card_power_off(struct rtsx_pcr *pcr, int card)
> diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
> index a66540a49079..b98cf1de0a55 100644
> --- a/drivers/mfd/rtsx_pcr.c
> +++ b/drivers/mfd/rtsx_pcr.c
> @@ -571,11 +571,7 @@ static int rtsx_pci_set_pull_ctl(struct rtsx_pcr *pcr, const u32 *tbl)
> tbl++;
> }
>
> - err = rtsx_pci_send_cmd(pcr, 100);
> - if (err < 0)
> - return err;
> -
> - return 0;
> + return rtsx_pci_send_cmd(pcr, 100);
> }
>
> int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card)

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/