diff mbox

[linux,dev-4.10,7/7] drivers/fsi: Fix one and two byte bus reads/writes

Message ID 20170509213902.37939-8-cbostic@linux.vnet.ibm.com
State Accepted, archived
Headers show

Commit Message

Christopher Bostic May 9, 2017, 9:39 p.m. UTC
From: Eddie James <eajames@us.ibm.com>

Address checker fixed to allow one and two byte reads/writes.
Address alignments for each size verified.

Signed-off-by: Edward James <eajames@us.ibm.com>
Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
---
 drivers/fsi/fsi-core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Joel Stanley May 11, 2017, 12:06 p.m. UTC | #1
On Wed, May 10, 2017 at 7:09 AM, Christopher Bostic
<cbostic@linux.vnet.ibm.com> wrote:
> From: Eddie James <eajames@us.ibm.com>
>
> Address checker fixed to allow one and two byte reads/writes.
> Address alignments for each size verified.
>
> Signed-off-by: Edward James <eajames@us.ibm.com>
> Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>

Applied to dev-4.10.

Cheers,

Joel
diff mbox

Patch

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 809a3c4..2a65aa6 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -699,10 +699,13 @@  static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
 /* FSI master support */
 static int fsi_check_access(uint32_t addr, size_t size)
 {
-	if (size != 1 && size != 2 && size != 4)
-		return -EINVAL;
-
-	if ((addr & 0x3) != (size & 0x3))
+	if (size == 4) {
+		if (addr & 0x3)
+			return -EINVAL;
+	} else if (size == 2) {
+		if (addr & 0x1)
+			return -EINVAL;
+	} else if (size != 1)
 		return -EINVAL;
 
 	return 0;