Skip to content

Commit

Permalink
MIPS: Remove invalid check
Browse files Browse the repository at this point in the history
Unsigned values cannot be lesser than zero.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[ralf@linux-mips.org: Chris Dearman's original commit
9318c51 ([MIPS] MIPS32/MIPS64 secondary
cache management) introduced these less than zero checks in 2.6.18.]

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: linux-kernel@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: Chris Dearman <chris.dearman@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/11165/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Andrzej Hajda authored and Ralf Baechle committed Oct 26, 2015
1 parent 32b8819 commit 0551399
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/mips/mm/sc-mips.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ static inline int __init mips_sc_probe(void)
return 0;

tmp = (config2 >> 8) & 0x0f;
if (0 <= tmp && tmp <= 7)
if (tmp <= 7)
c->scache.sets = 64 << tmp;
else
return 0;

tmp = (config2 >> 0) & 0x0f;
if (0 <= tmp && tmp <= 7)
if (tmp <= 7)
c->scache.ways = tmp + 1;
else
return 0;
Expand Down

0 comments on commit 0551399

Please sign in to comment.