diff options
author | Quentin Deslandes <quentin.deslandes@itdev.co.uk> | 2019-05-20 16:39:02 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-21 08:25:03 +0200 |
commit | 7156f7d9c38799ebb5d9d92e90207ff227ec4ade (patch) | |
tree | 555193f62ba092e31eb19034279b2f369ad8c3ad /drivers/staging/vt6656/baseband.c | |
parent | 59608cb1de185613b3a7b1615a9b08480f5a566a (diff) |
staging: vt6656: avoid discarding called function's return code
Change some of the driver's functions in order to handle error codes
instead of discarding them. These function now returns 0 on success and
a negative errno value on error.
Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656/baseband.c')
-rw-r--r-- | drivers/staging/vt6656/baseband.c | 130 |
1 files changed, 89 insertions, 41 deletions
diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index b29ba237fa29..8d19ae71e7cc 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -329,7 +329,7 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, * Return Value: none * */ -void vnt_set_antenna_mode(struct vnt_private *priv, u8 antenna_mode) +int vnt_set_antenna_mode(struct vnt_private *priv, u8 antenna_mode) { switch (antenna_mode) { case ANT_TXA: @@ -344,8 +344,8 @@ void vnt_set_antenna_mode(struct vnt_private *priv, u8 antenna_mode) break; } - vnt_control_out(priv, MESSAGE_TYPE_SET_ANTMD, - (u16)antenna_mode, 0, 0, NULL); + return vnt_control_out(priv, MESSAGE_TYPE_SET_ANTMD, + (u16)antenna_mode, 0, 0, NULL); } /* @@ -364,7 +364,7 @@ void vnt_set_antenna_mode(struct vnt_private *priv, u8 antenna_mode) int vnt_vt3184_init(struct vnt_private *priv) { - int status; + int ret = 0; u16 length; u8 *addr; u8 *agc; @@ -372,11 +372,10 @@ int vnt_vt3184_init(struct vnt_private *priv) u8 array[256]; u8 data; - status = vnt_control_in(priv, MESSAGE_TYPE_READ, 0, - MESSAGE_REQUEST_EEPROM, EEP_MAX_CONTEXT_SIZE, - priv->eeprom); - if (status != STATUS_SUCCESS) - return false; + ret = vnt_control_in(priv, MESSAGE_TYPE_READ, 0, MESSAGE_REQUEST_EEPROM, + EEP_MAX_CONTEXT_SIZE, priv->eeprom); + if (ret) + goto end; priv->rf_type = priv->eeprom[EEP_OFS_RFTYPE]; @@ -423,8 +422,10 @@ int vnt_vt3184_init(struct vnt_private *priv) priv->bb_vga[3] = 0x0; /* Fix VT3226 DFC system timing issue */ - vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, - SOFTPWRCTL_RFLEOPT); + ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, + SOFTPWRCTL_RFLEOPT); + if (ret) + goto end; } else if (priv->rf_type == RF_VT3342A0) { priv->bb_rx_conf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); @@ -438,48 +439,74 @@ int vnt_vt3184_init(struct vnt_private *priv) priv->bb_vga[3] = 0x0; /* Fix VT3226 DFC system timing issue */ - vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, - SOFTPWRCTL_RFLEOPT); + ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, + SOFTPWRCTL_RFLEOPT); + if (ret) + goto end; } else { - return true; + goto end; } memcpy(array, addr, length); - vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_BBREG, length, array); + ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, + MESSAGE_REQUEST_BBREG, length, array); + if (ret) + goto end; memcpy(array, agc, length_agc); - vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_BBAGC, length_agc, array); + ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, + MESSAGE_REQUEST_BBAGC, length_agc, array); + if (ret) + goto end; if ((priv->rf_type == RF_VT3226) || (priv->rf_type == RF_VT3342A0)) { - vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, - MAC_REG_ITRTMSET, 0x23); - vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01); + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, + MAC_REG_ITRTMSET, 0x23); + if (ret) + goto end; + + ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01); + if (ret) + goto end; } else if (priv->rf_type == RF_VT3226D0) { - vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, - MAC_REG_ITRTMSET, 0x11); - vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01); + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, + MAC_REG_ITRTMSET, 0x11); + if (ret) + goto end; + + ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01); + if (ret) + goto end; } - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x04, 0x7f); - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01); + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x04, 0x7f); + if (ret) + goto end; - vnt_rf_table_download(priv); + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01); + if (ret) + goto end; + + ret = vnt_rf_table_download(priv); + if (ret) + goto end; /* Fix for TX USB resets from vendors driver */ - vnt_control_in(priv, MESSAGE_TYPE_READ, USB_REG4, - MESSAGE_REQUEST_MEM, sizeof(data), &data); + ret = vnt_control_in(priv, MESSAGE_TYPE_READ, USB_REG4, + MESSAGE_REQUEST_MEM, sizeof(data), &data); + if (ret) + goto end; data |= 0x2; - vnt_control_out(priv, MESSAGE_TYPE_WRITE, USB_REG4, - MESSAGE_REQUEST_MEM, sizeof(data), &data); + ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, USB_REG4, + MESSAGE_REQUEST_MEM, sizeof(data), &data); - return true; +end: + return ret; } /* @@ -494,8 +521,9 @@ int vnt_vt3184_init(struct vnt_private *priv) * Return Value: none * */ -void vnt_set_short_slot_time(struct vnt_private *priv) +int vnt_set_short_slot_time(struct vnt_private *priv) { + int ret = 0; u8 bb_vga = 0; if (priv->short_slot_time) @@ -503,12 +531,18 @@ void vnt_set_short_slot_time(struct vnt_private *priv) else priv->bb_rx_conf |= 0x20; - vnt_control_in_u8(priv, MESSAGE_REQUEST_BBREG, 0xe7, &bb_vga); + ret = vnt_control_in_u8(priv, MESSAGE_REQUEST_BBREG, 0xe7, &bb_vga); + if (ret) + goto end; if (bb_vga == priv->bb_vga[0]) priv->bb_rx_conf |= 0x20; - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a, priv->bb_rx_conf); + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a, + priv->bb_rx_conf); + +end: + return ret; } void vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data) @@ -536,16 +570,30 @@ void vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data) * Return Value: none * */ -void vnt_set_deep_sleep(struct vnt_private *priv) +int vnt_set_deep_sleep(struct vnt_private *priv) { - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);/* CR12 */ - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0xB9);/* CR13 */ + int ret = 0; + + /* CR12 */ + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0c, 0x17); + if (ret) + return ret; + + /* CR13 */ + return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0xB9); } -void vnt_exit_deep_sleep(struct vnt_private *priv) +int vnt_exit_deep_sleep(struct vnt_private *priv) { - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0c, 0x00);/* CR12 */ - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01);/* CR13 */ + int ret = 0; + + /* CR12 */ + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0c, 0x00); + if (ret) + return ret; + + /* CR13 */ + return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01); } void vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning) |