@@ -71,27 +71,15 @@ static void test_wdt_feed(void)
71
71
72
72
/* Find the watchdog device according to the name and obtain the handle */
73
73
wdg_dev = rt_device_find (IWDG_DEVICE_NAME );
74
- if (!wdg_dev )
75
- {
76
- LOG_E ("find %s failed!\n" , IWDG_DEVICE_NAME );
77
- return ;
78
- }
74
+ uassert_not_null (wdg_dev );
79
75
80
76
/* Initialize the device */
81
77
ret = rt_device_init (wdg_dev );
82
- if (ret != RT_EOK )
83
- {
84
- LOG_E ("initialize %s failed!\n" , IWDG_DEVICE_NAME );
85
- return ;
86
- }
78
+ uassert_int_equal (ret , RT_EOK );
87
79
88
80
/* Set the watchdog timeout time */
89
81
ret = rt_device_control (wdg_dev , KD_DEVICE_CTRL_WDT_SET_TIMEOUT , & timeout );
90
- if (ret != RT_EOK )
91
- {
92
- LOG_E ("set %s timeout failed!\n" , IWDG_DEVICE_NAME );
93
- return ;
94
- }
82
+ uassert_int_equal (ret , RT_EOK );
95
83
96
84
flag_feed = 1 ; /* Set feed the dog sign */
97
85
@@ -118,27 +106,15 @@ static void test_wdt_nofeed(void)
118
106
119
107
/* Find the watchdog device according to the name and obtain the handle */
120
108
wdg_dev = rt_device_find (IWDG_DEVICE_NAME );
121
- if (!wdg_dev )
122
- {
123
- LOG_E ("find %s failed!\n" , IWDG_DEVICE_NAME );
124
- return ;
125
- }
109
+ uassert_not_null (wdg_dev );
126
110
127
111
/* Initialize the device */
128
112
ret = rt_device_init (wdg_dev );
129
- if (ret != RT_EOK )
130
- {
131
- LOG_E ("initialize %s failed!\n" , IWDG_DEVICE_NAME );
132
- return ;
133
- }
113
+ uassert_int_equal (ret , RT_EOK );
134
114
135
115
/* Set the watchdog timeout time */
136
116
ret = rt_device_control (wdg_dev , KD_DEVICE_CTRL_WDT_SET_TIMEOUT , & timeout );
137
- if (ret != RT_EOK )
138
- {
139
- LOG_E ("set %s timeout failed!\n" , IWDG_DEVICE_NAME );
140
- return ;
141
- }
117
+ uassert_int_equal (ret , RT_EOK );
142
118
143
119
flag_feed = 0 ; /* Do not feed the dog */
144
120
0 commit comments