diff options
Diffstat (limited to 'arch/blackfin/mm/isram-driver.c')
-rw-r--r-- | arch/blackfin/mm/isram-driver.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/blackfin/mm/isram-driver.c b/arch/blackfin/mm/isram-driver.c index 84cdc5a1c139..39b058564f62 100644 --- a/arch/blackfin/mm/isram-driver.c +++ b/arch/blackfin/mm/isram-driver.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
16 | 17 | ||
@@ -62,7 +63,7 @@ static void isram_write(const void *addr, uint64_t data) | |||
62 | uint32_t cmd; | 63 | uint32_t cmd; |
63 | unsigned long flags; | 64 | unsigned long flags; |
64 | 65 | ||
65 | if (addr >= (void *)(L1_CODE_START + L1_CODE_LENGTH)) | 66 | if (unlikely(addr >= (void *)(L1_CODE_START + L1_CODE_LENGTH))) |
66 | return; | 67 | return; |
67 | 68 | ||
68 | cmd = IADDR2DTEST(addr) | 2; /* write */ | 69 | cmd = IADDR2DTEST(addr) | 2; /* write */ |
@@ -93,7 +94,7 @@ static uint64_t isram_read(const void *addr) | |||
93 | unsigned long flags; | 94 | unsigned long flags; |
94 | uint64_t ret; | 95 | uint64_t ret; |
95 | 96 | ||
96 | if (addr > (void *)(L1_CODE_START + L1_CODE_LENGTH)) | 97 | if (unlikely(addr > (void *)(L1_CODE_START + L1_CODE_LENGTH))) |
97 | return 0; | 98 | return 0; |
98 | 99 | ||
99 | cmd = IADDR2DTEST(addr) | 0; /* read */ | 100 | cmd = IADDR2DTEST(addr) | 0; /* read */ |
@@ -120,7 +121,7 @@ static bool isram_check_addr(const void *addr, size_t n) | |||
120 | { | 121 | { |
121 | if ((addr >= (void *)L1_CODE_START) && | 122 | if ((addr >= (void *)L1_CODE_START) && |
122 | (addr < (void *)(L1_CODE_START + L1_CODE_LENGTH))) { | 123 | (addr < (void *)(L1_CODE_START + L1_CODE_LENGTH))) { |
123 | if ((addr + n) > (void *)(L1_CODE_START + L1_CODE_LENGTH)) { | 124 | if (unlikely((addr + n) > (void *)(L1_CODE_START + L1_CODE_LENGTH))) { |
124 | show_stack(NULL, NULL); | 125 | show_stack(NULL, NULL); |
125 | pr_err("copy involving %p length (%zu) too long\n", addr, n); | 126 | pr_err("copy involving %p length (%zu) too long\n", addr, n); |
126 | } | 127 | } |