diff options
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 8 | ||||
-rw-r--r-- | tools/testing/selftests/powerpc/mm/wild_bctr.c | 21 |
2 files changed, 22 insertions, 7 deletions
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 9527d47a1070..01ec04bf91b5 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -140,8 +140,8 @@ static u32 handle[] = { | |||
140 | [6] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 1), | 140 | [6] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 1), |
141 | }; | 141 | }; |
142 | 142 | ||
143 | static unsigned long dimm_fail_cmd_flags[NUM_DCR]; | 143 | static unsigned long dimm_fail_cmd_flags[ARRAY_SIZE(handle)]; |
144 | static int dimm_fail_cmd_code[NUM_DCR]; | 144 | static int dimm_fail_cmd_code[ARRAY_SIZE(handle)]; |
145 | 145 | ||
146 | static const struct nd_intel_smart smart_def = { | 146 | static const struct nd_intel_smart smart_def = { |
147 | .flags = ND_INTEL_SMART_HEALTH_VALID | 147 | .flags = ND_INTEL_SMART_HEALTH_VALID |
@@ -205,7 +205,7 @@ struct nfit_test { | |||
205 | unsigned long deadline; | 205 | unsigned long deadline; |
206 | spinlock_t lock; | 206 | spinlock_t lock; |
207 | } ars_state; | 207 | } ars_state; |
208 | struct device *dimm_dev[NUM_DCR]; | 208 | struct device *dimm_dev[ARRAY_SIZE(handle)]; |
209 | struct nd_intel_smart *smart; | 209 | struct nd_intel_smart *smart; |
210 | struct nd_intel_smart_threshold *smart_threshold; | 210 | struct nd_intel_smart_threshold *smart_threshold; |
211 | struct badrange badrange; | 211 | struct badrange badrange; |
@@ -2680,7 +2680,7 @@ static int nfit_test_probe(struct platform_device *pdev) | |||
2680 | u32 nfit_handle = __to_nfit_memdev(nfit_mem)->device_handle; | 2680 | u32 nfit_handle = __to_nfit_memdev(nfit_mem)->device_handle; |
2681 | int i; | 2681 | int i; |
2682 | 2682 | ||
2683 | for (i = 0; i < NUM_DCR; i++) | 2683 | for (i = 0; i < ARRAY_SIZE(handle); i++) |
2684 | if (nfit_handle == handle[i]) | 2684 | if (nfit_handle == handle[i]) |
2685 | dev_set_drvdata(nfit_test->dimm_dev[i], | 2685 | dev_set_drvdata(nfit_test->dimm_dev[i], |
2686 | nfit_mem); | 2686 | nfit_mem); |
diff --git a/tools/testing/selftests/powerpc/mm/wild_bctr.c b/tools/testing/selftests/powerpc/mm/wild_bctr.c index 1b0e9e9a2ddc..f2fa101c5a6a 100644 --- a/tools/testing/selftests/powerpc/mm/wild_bctr.c +++ b/tools/testing/selftests/powerpc/mm/wild_bctr.c | |||
@@ -47,8 +47,9 @@ static int ok(void) | |||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | #define REG_POISON 0x5a5aUL | 50 | #define REG_POISON 0x5a5a |
51 | #define POISONED_REG(n) ((REG_POISON << 48) | ((n) << 32) | (REG_POISON << 16) | (n)) | 51 | #define POISONED_REG(n) ((((unsigned long)REG_POISON) << 48) | ((n) << 32) | \ |
52 | (((unsigned long)REG_POISON) << 16) | (n)) | ||
52 | 53 | ||
53 | static inline void poison_regs(void) | 54 | static inline void poison_regs(void) |
54 | { | 55 | { |
@@ -105,6 +106,20 @@ static void dump_regs(void) | |||
105 | } | 106 | } |
106 | } | 107 | } |
107 | 108 | ||
109 | #ifdef _CALL_AIXDESC | ||
110 | struct opd { | ||
111 | unsigned long ip; | ||
112 | unsigned long toc; | ||
113 | unsigned long env; | ||
114 | }; | ||
115 | static struct opd bad_opd = { | ||
116 | .ip = BAD_NIP, | ||
117 | }; | ||
118 | #define BAD_FUNC (&bad_opd) | ||
119 | #else | ||
120 | #define BAD_FUNC BAD_NIP | ||
121 | #endif | ||
122 | |||
108 | int test_wild_bctr(void) | 123 | int test_wild_bctr(void) |
109 | { | 124 | { |
110 | int (*func_ptr)(void); | 125 | int (*func_ptr)(void); |
@@ -133,7 +148,7 @@ int test_wild_bctr(void) | |||
133 | 148 | ||
134 | poison_regs(); | 149 | poison_regs(); |
135 | 150 | ||
136 | func_ptr = (int (*)(void))BAD_NIP; | 151 | func_ptr = (int (*)(void))BAD_FUNC; |
137 | func_ptr(); | 152 | func_ptr(); |
138 | 153 | ||
139 | FAIL_IF(1); /* we didn't segv? */ | 154 | FAIL_IF(1); /* we didn't segv? */ |