Skip to content

Commit

Permalink
Blackfin: isram: add unlikely to sanity checks
Browse files Browse the repository at this point in the history
Don't want the compiler assuming the rare sanity checks are the norm and
optimize for those paths.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
  • Loading branch information
Mike Frysinger committed Mar 9, 2010
1 parent 0ea19c6 commit f05ede3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/blackfin/mm/isram-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void isram_write(const void *addr, uint64_t data)
uint32_t cmd;
unsigned long flags;

if (addr >= (void *)(L1_CODE_START + L1_CODE_LENGTH))
if (unlikely(addr >= (void *)(L1_CODE_START + L1_CODE_LENGTH)))
return;

cmd = IADDR2DTEST(addr) | 2; /* write */
Expand Down Expand Up @@ -93,7 +93,7 @@ static uint64_t isram_read(const void *addr)
unsigned long flags;
uint64_t ret;

if (addr > (void *)(L1_CODE_START + L1_CODE_LENGTH))
if (unlikely(addr > (void *)(L1_CODE_START + L1_CODE_LENGTH)))
return 0;

cmd = IADDR2DTEST(addr) | 0; /* read */
Expand All @@ -120,7 +120,7 @@ static bool isram_check_addr(const void *addr, size_t n)
{
if ((addr >= (void *)L1_CODE_START) &&
(addr < (void *)(L1_CODE_START + L1_CODE_LENGTH))) {
if ((addr + n) > (void *)(L1_CODE_START + L1_CODE_LENGTH)) {
if (unlikely((addr + n) > (void *)(L1_CODE_START + L1_CODE_LENGTH))) {
show_stack(NULL, NULL);
pr_err("copy involving %p length (%zu) too long\n", addr, n);
}
Expand Down

0 comments on commit f05ede3

Please sign in to comment.