mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Cc: Eddie James <eajames@us.ibm.com>, Jeremy Kerr <jk@ozlabs.org>,
	Christopher Bostic <cbostic@linux.vnet.ibm.com>,
	Brad Bishop <bradleyb@fuzziesquirrel.com>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: [PATCH 04/10] fsi: Fix one and two byte bus reads/writes
Date: Mon, 12 Feb 2018 15:45:43 +1030	[thread overview]
Message-ID: <20180212051549.8575-5-joel@jms.id.au> (raw)
In-Reply-To: <20180212051549.8575-1-joel@jms.id.au>

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>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 6e5aa9b26665..e5dfece248a5 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -656,10 +656,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;
-- 
2.15.1

  parent reply	other threads:[~2018-02-12  5:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12  5:15 [PATCH 00/10] FSI enhancements for v4.17 Joel Stanley
2018-02-12  5:15 ` [PATCH 01/10] fsi: Add fsi_master_rescan() Joel Stanley
2018-02-12  5:15 ` [PATCH 02/10] fsi: master-gpio: Add locking during break and link enable Joel Stanley
2018-02-12  5:15 ` [PATCH 03/10] fsi: master-gpio: Add external mode Joel Stanley
2018-02-12  5:15 ` Joel Stanley [this message]
2018-02-12  5:15 ` [PATCH 05/10] dt-bindings: fsi: Add specification for FSI busses Joel Stanley
2018-02-12  5:15 ` [PATCH 06/10] fsi: Match fsi slaves and engines to available dt nodes Joel Stanley
2018-02-12  5:15 ` [PATCH 07/10] fsi: core: Reduce console output during normal scan Joel Stanley
2018-02-12  5:15 ` [PATCH 08/10] fsi: master: Clarify master lifetimes & fix use-after-free in hub master Joel Stanley
2018-02-12  5:15 ` [PATCH 09/10] dt-bindings: fsi: Add optional property no-scan-on-init Joel Stanley
2018-02-12 14:36   ` Rob Herring
2018-02-13  2:49     ` Joel Stanley
2018-02-12  5:15 ` [PATCH 10/10] fsi: core: Add check for master " Joel Stanley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180212051549.8575-5-joel@jms.id.au \
    --to=joel@jms.id.au \
    --cc=bradleyb@fuzziesquirrel.com \
    --cc=cbostic@linux.vnet.ibm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eajames@us.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jk@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®