tests: ibecc: Fix using global device pointer
Removing global device pointer fixes issues with uninitialized device. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
69ac4b29de
commit
b565683aec
1 changed files with 17 additions and 4 deletions
|
@ -22,10 +22,10 @@
|
|||
#define DURATION 100
|
||||
#endif
|
||||
|
||||
const struct device *dev;
|
||||
|
||||
static void test_ibecc_initialized(void)
|
||||
{
|
||||
const struct device *dev;
|
||||
|
||||
dev = device_get_binding(DEVICE_NAME);
|
||||
zassert_not_null(dev, "Device not found");
|
||||
|
||||
|
@ -52,11 +52,15 @@ static void callback(const struct device *d, void *data)
|
|||
|
||||
static void test_ibecc_api(void)
|
||||
{
|
||||
const struct device *dev;
|
||||
uint64_t value;
|
||||
int ret;
|
||||
|
||||
/* Error log API */
|
||||
|
||||
dev = device_get_binding(DEVICE_NAME);
|
||||
zassert_not_null(dev, "Device not found");
|
||||
|
||||
ret = edac_ecc_error_log_get(dev, &value);
|
||||
zassert_equal(ret, -ENODATA, "edac_ecc_error_log_get failed");
|
||||
|
||||
|
@ -86,10 +90,14 @@ static void test_ibecc_api(void)
|
|||
#if defined(CONFIG_EDAC_ERROR_INJECT)
|
||||
static void test_ibecc_error_inject_api(void)
|
||||
{
|
||||
const struct device *dev;
|
||||
uint32_t test_value;
|
||||
uint64_t val;
|
||||
int ret;
|
||||
|
||||
dev = device_get_binding(DEVICE_NAME);
|
||||
zassert_not_null(dev, "Device not found");
|
||||
|
||||
/* Verify default parameters */
|
||||
|
||||
ret = edac_inject_get_error_type(dev, &test_value);
|
||||
|
@ -154,7 +162,8 @@ static void test_ibecc_error_inject_api(void)
|
|||
#endif
|
||||
|
||||
#if defined(CONFIG_EDAC_ERROR_INJECT)
|
||||
static void test_inject(uint64_t addr, uint64_t mask, uint8_t type)
|
||||
static void test_inject(const struct device *dev, uint64_t addr, uint64_t mask,
|
||||
uint8_t type)
|
||||
{
|
||||
unsigned int errors_cor, errors_uc;
|
||||
uint64_t test_addr;
|
||||
|
@ -258,13 +267,17 @@ static int check_values(void *p1, void *p2, void *p3)
|
|||
|
||||
static void ibecc_error_inject_test(uint64_t addr, uint64_t mask, uint64_t type)
|
||||
{
|
||||
const struct device *dev;
|
||||
int ret;
|
||||
|
||||
dev = device_get_binding(DEVICE_NAME);
|
||||
zassert_not_null(dev, "Device not found");
|
||||
|
||||
ret = edac_notify_callback_set(dev, callback);
|
||||
zassert_equal(ret, 0, "Error setting notification callback");
|
||||
|
||||
/* Test injecting correctable error at address TEST_ADDRESS1 */
|
||||
test_inject(addr, mask, type);
|
||||
test_inject(dev, addr, mask, type);
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
k_thread_user_mode_enter((k_thread_entry_t)check_values,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue