Bug 229722 - src/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c:1022: faulty logic ?
Summary: src/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c:1022: faulty logic ?
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Oleksandr Tymoshenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-12 11:02 UTC by David Binderman
Modified: 2018-07-16 01:09 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2018-07-12 11:02:23 UTC
src/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c:1026]: (warning) Opposite inner 'if' condition leads to a dead code block.

Source code is

       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;

return statement can never execute.
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-07-16 01:08:32 UTC
A commit references this bug:

Author: gonzo
Date: Mon Jul 16 01:07:29 UTC 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

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