From: Shreeya Patel Date: Sun, 10 Dec 2017 22:03:00 +0000 (+0530) Subject: Staging: rtl8723bs: Merge assignment with return X-Git-Tag: v4.16-rc1~112^2~336 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=5826e028de7f2db8d8deebf2102cd79086729200;p=linux.git Staging: rtl8723bs: Merge assignment with return Merge the assignment and return statements to return the value directly. Done using the following semantic patch by coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Also, remove the variable declaration and some braces that became useless after the merge. Signed-off-by: Shreeya Patel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 9a4c24861947..93ac0832c335 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -157,23 +157,20 @@ static u32 _cvrt2ftaddr(const u32 addr, u8 *pdeviceId, u16 *poffset) static u8 sdio_read8(struct intf_hdl *pintfhdl, u32 addr) { u32 ftaddr; - u8 val; - ftaddr = _cvrt2ftaddr(addr, NULL, NULL); - val = sd_read8(pintfhdl, ftaddr, NULL); - return val; + + return sd_read8(pintfhdl, ftaddr, NULL); } static u16 sdio_read16(struct intf_hdl *pintfhdl, u32 addr) { u32 ftaddr; - u16 val; __le16 le_tmp; ftaddr = _cvrt2ftaddr(addr, NULL, NULL); sd_cmd52_read(pintfhdl, ftaddr, 2, (u8 *)&le_tmp); - val = le16_to_cpu(le_tmp); - return val; + + return le16_to_cpu(le_tmp); } static u32 sdio_read32(struct intf_hdl *pintfhdl, u32 addr) @@ -201,8 +198,7 @@ static u32 sdio_read32(struct intf_hdl *pintfhdl, u32 addr) #ifdef SDIO_DEBUG_IO if (!err) { #endif - val = le32_to_cpu(le_tmp); - return val; + return le32_to_cpu(le_tmp); #ifdef SDIO_DEBUG_IO } @@ -254,10 +250,8 @@ static s32 sdio_readN(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pbuf) ((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (false == bMacPwrCtrlOn) || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) - ) { - err = sd_cmd52_read(pintfhdl, ftaddr, cnt, pbuf); - return err; - } + ) + return sd_cmd52_read(pintfhdl, ftaddr, cnt, pbuf); /* 4 bytes alignment */ shift = ftaddr & 0x3; @@ -295,14 +289,11 @@ static s32 sdio_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) static s32 sdio_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) { u32 ftaddr; - s32 err; __le16 le_tmp; ftaddr = _cvrt2ftaddr(addr, NULL, NULL); le_tmp = cpu_to_le16(val); - err = sd_cmd52_write(pintfhdl, ftaddr, 2, (u8 *)&le_tmp); - - return err; + return sd_cmd52_write(pintfhdl, ftaddr, 2, (u8 *)&le_tmp); } static s32 sdio_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) @@ -328,8 +319,8 @@ static s32 sdio_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) ) { le_tmp = cpu_to_le32(val); - err = sd_cmd52_write(pintfhdl, ftaddr, 4, (u8 *)&le_tmp); - return err; + + return sd_cmd52_write(pintfhdl, ftaddr, 4, (u8 *)&le_tmp); } /* 4 bytes alignment */ @@ -363,10 +354,8 @@ static s32 sdio_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pbuf) ((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (false == bMacPwrCtrlOn) || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) - ) { - err = sd_cmd52_write(pintfhdl, ftaddr, cnt, pbuf); - return err; - } + ) + return sd_cmd52_write(pintfhdl, ftaddr, cnt, pbuf); shift = ftaddr & 0x3; if (shift == 0) { @@ -588,10 +577,8 @@ static s32 _sdio_local_read( HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if (false == bMacPwrCtrlOn) { - err = _sd_cmd52_read(pintfhdl, addr, cnt, pbuf); - return err; - } + if (false == bMacPwrCtrlOn) + return _sd_cmd52_read(pintfhdl, addr, cnt, pbuf); n = RND4(cnt); ptmpbuf = rtw_malloc(n); @@ -631,10 +618,8 @@ s32 sdio_local_read( if ( (false == bMacPwrCtrlOn) || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) - ) { - err = sd_cmd52_read(pintfhdl, addr, cnt, pbuf); - return err; - } + ) + return sd_cmd52_read(pintfhdl, addr, cnt, pbuf); n = RND4(cnt); ptmpbuf = rtw_malloc(n); @@ -679,10 +664,8 @@ s32 sdio_local_write( if ( (false == bMacPwrCtrlOn) || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) - ) { - err = sd_cmd52_write(pintfhdl, addr, cnt, pbuf); - return err; - } + ) + return sd_cmd52_write(pintfhdl, addr, cnt, pbuf); ptmpbuf = rtw_malloc(cnt); if (!ptmpbuf)