Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jul 2018 01:07:28 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336325 - head/sys/arm/broadcom/bcm2835
Message-ID:  <201807160107.w6G17SKC023127@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Mon Jul 16 01:07:28 2018
New Revision: 336325
URL: https://svnweb.freebsd.org/changeset/base/336325

Log:
  Remove two checks that are always false
  
  Outer loop condition contradicts inner check so code under inner condition
  is not reachable. Remove it.
  
  PR:		229722
  Reported by:	David Binderman

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c	Mon Jul 16 00:28:33 2018	(r336324)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c	Mon Jul 16 01:07:28 2018	(r336325)
@@ -1022,12 +1022,8 @@ bcm_sdhost_read_multi_4(device_t dev, struct sdhci_slo
 	for (i = 0; i < count;) {
 		edm = RD4(sc, HC_DEBUG);
 		avail = ((edm >> 4) & 0x1f);
-		if (i + avail > count) {
-			if (i >= count)
-				return;
-			else
-				avail = count - i;
-		}
+		if (i + avail > count)
+			avail = count - i;
 		if (avail > 0)
 			bus_space_read_multi_4(sc->sc_bst, sc->sc_bsh,
 			    HC_DATAPORT, data + i, avail);
@@ -1234,12 +1230,8 @@ bcm_sdhost_write_multi_4(device_t dev, struct sdhci_sl
 	for (i = 0; i < count;) {
 		edm = RD4(sc, HC_DEBUG);
 		space = HC_FIFO_SIZE - ((edm >> 4) & 0x1f);
-		if (i + space > count) {
-			if (i >= count)
-				return;
-			else
-				space = count - i;
-		}
+		if (i + space > count)
+			space = count - i;
 		if (space > 0)
 			bus_space_write_multi_4(sc->sc_bst, sc->sc_bsh,
 			    HC_DATAPORT, data + i, space);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807160107.w6G17SKC023127>