Skip to contentSkip to conversation

staging: rtl8723bs: Align address to 4-byte boundary

PATCH In review Abhinav Jain 3 participants 3 messages Jun 14, 2024 – Jun 24, 2024 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: Align address to 4-byte boundary

Add address alignment in sdio_local_read, _sdio_local_read & sdio_local_write functions as per the TODO.

---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/hal/sdio_ops.c +3 -9
index 107f427ee4aa..caee2d2043b3 100644
@@ -478,9 +478,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
 	ops->_write_port = &sdio_write_port;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 static s32 _sdio_local_read(
 	struct adapter *adapter,
 	u32 addr,
@@ -494,6 +491,7 @@ static s32 _sdio_local_read(
 	u8 *tmpbuf;
 	u32 n;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
@@ -516,9 +514,6 @@ static s32 _sdio_local_read(
 	return err;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 s32 sdio_local_read(
 	struct adapter *adapter,
 	u32 addr,
@@ -532,6 +527,7 @@ s32 sdio_local_read(
 	u8 *tmpbuf;
 	u32 n;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
@@ -557,9 +553,6 @@ s32 sdio_local_read(
 	return err;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 s32 sdio_local_write(
 	struct adapter *adapter,
 	u32 addr,
@@ -572,6 +565,7 @@ s32 sdio_local_write(
 	s32 err;
 	u8 *tmpbuf;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 59 lines · Abhinav Jain

Add address alignment in sdio_local_read, _sdio_local_read & sdio_local_write functions as per the TODO.

---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/hal/sdio_ops.c +2 -9
index 107f427ee4aa..caee2d2043b3 100644
@@ -478,9 +478,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
 	ops->_write_port = &sdio_write_port;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 static s32 _sdio_local_read(
 	struct adapter *adapter,
 	u32 addr,
@@ -494,6 +491,7 @@ static s32 _sdio_local_read(
 	u8 *tmpbuf;
 	u32 n;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
@@ -516,9 +514,6 @@ static s32 _sdio_local_read(
 	return err;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 s32 sdio_local_read(
 	struct adapter *adapter,
 	u32 addr,
@@ -532,6 +527,7 @@ s32 sdio_local_read(
 	u8 *tmpbuf;
 	u32 n;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
@@ -557,9 +553,6 @@ s32 sdio_local_read(
 	return err;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 s32 sdio_local_write(
 	struct adapter *adapter,
 	u32 addr,

drivers/staging/rtl8723bs/hal/sdio_ops.c s32 sdio_local_write( · line 571

Quoted 7 lines
drivers/staging/rtl8723bs/hal/sdio_ops.c +1 -0
@@ -572,6 +565,7 @@ s32 sdio_local_write(
 	s32 err;
 	u8 *tmpbuf;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);

Tthese functions are never called with "addr" that is not 4-byte-aligned. So I don't think this patch is what the Todo notes meant.

Best regards,
Nam

maintainer
#2 lore raw
In reply to Abhinav Jain
Quoted 2 lines · Abhinav Jain

Add address alignment in sdio_local_read, _sdio_local_read & sdio_local_write functions as per the TODO.

How was this tested?

Quoted 21 lines
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/hal/sdio_ops.c +0 -3
index 107f427ee4aa..caee2d2043b3 100644
@@ -478,9 +478,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
 	ops->_write_port = &sdio_write_port;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 static s32 _sdio_local_read(
 	struct adapter *adapter,
 	u32 addr,

drivers/staging/rtl8723bs/hal/sdio_ops.c static s32 _sdio_local_read( · line 494

Quoted 4 lines
drivers/staging/rtl8723bs/hal/sdio_ops.c +1 -0
@@ -494,6 +491,7 @@ static s32 _sdio_local_read(
 	u8 *tmpbuf;
 	u32 n;
 
+	addr = addr & ~3;

Are you sure you are allowed to do this? Why? And a comment about what you are doing, and why it is required to do so, is needed for this to be acceptable.

thanks,

greg k-h