[PATCH RFC 3/3] staging: r8188eu: add error argument to read_macreg

Pavel Skripkin
2021-08-20T17:07:49Z

Since read_macreg() calls rtw_read*() internally we should tell
callers about an error on the read side.

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
drivers/staging/r8188eu/core/rtw_mp.c | 9 ++++-----
drivers/staging/r8188eu/include/rtw_mp.h | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mp.c b/drivers/staging/r8188eu/core/rtw_mp.c
index 601a1fd5d4e7..6bbea1cc364a 100644
--- a/drivers/staging/r8188eu/core/rtw_mp.c
+++ b/drivers/staging/r8188eu/core/rtw_mp.c
@@ -7,20 +7,19 @@
#include "../include/odm_precomp.h"
#include "../include/rtl8188e_hal.h"

-u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz)
+u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz, int *error)
{
u32 val = 0;
- int error;

switch (sz) {
case 1:
- val = rtw_read8(padapter, addr, &error);
+ val = rtw_read8(padapter, addr, error);
break;
case 2:
- val = rtw_read16(padapter, addr, &error);
+ val = rtw_read16(padapter, addr, error);
break;
case 4:
- val = rtw_read32(padapter, addr, &error);
+ val = rtw_read32(padapter, addr, error);
break;
default:
val = 0xffffffff;
diff --git a/drivers/staging/r8188eu/include/rtw_mp.h b/drivers/staging/r8188eu/include/rtw_mp.h
index b64b16554343..c063e6216249 100644
--- a/drivers/staging/r8188eu/include/rtw_mp.h
+++ b/drivers/staging/r8188eu/include/rtw_mp.h
@@ -410,7 +410,7 @@ void mp_stop_test(struct adapter *padapter);
u32 _read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask);
void _write_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask, u32 val);

-u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz);
+u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz, int *error);
void write_macreg(struct adapter *padapter, u32 addr, u32 val, u32 sz);
u32 read_bbreg(struct adapter *padapter, u32 addr, u32 bitmask);
void write_bbreg(struct adapter *padapter, u32 addr, u32 bitmask, u32 val);
--
2.32.0