@@ -108,28 +108,27 @@ int wifi_credentials_get_by_ssid_personal_struct(const char *ssid, size_t ssid_l
108
108
int ret ;
109
109
110
110
if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0 ) {
111
- LOG_ERR ("Cannot retrieve WiFi credentials, SSID has invalid format" );
111
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "retrieve" , " SSID has invalid format" );
112
112
return - EINVAL ;
113
113
}
114
114
115
115
if (buf == NULL ) {
116
- LOG_ERR ("Cannot retrieve WiFi credentials, "
117
- "destination struct pointer cannot be NULL" );
116
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "retrieve" , "destination is NULL" );
118
117
return - EINVAL ;
119
118
}
120
119
121
120
k_mutex_lock (& wifi_credentials_mutex , K_FOREVER );
122
121
123
122
idx = lookup_idx (ssid , ssid_len );
124
123
if (idx == -1 ) {
125
- LOG_DBG ("Cannot retrieve WiFi credentials, no entry found for the provided SSID " );
124
+ LOG_DBG ("Cannot %s WiFi credentials, %s" , "retrieve" , "SSID not found " );
126
125
ret = - ENOENT ;
127
126
goto exit ;
128
127
}
129
128
130
129
ret = wifi_credentials_load_entry (idx , buf , sizeof (struct wifi_credentials_personal ));
131
130
if (ret ) {
132
- LOG_ERR ("Failed to load WiFi credentials at index %d, err: %d" , idx , ret );
131
+ LOG_ERR ("Failed to %s WiFi credentials at index %d, err: %d" , "load " , idx , ret );
133
132
goto exit ;
134
133
}
135
134
@@ -155,12 +154,12 @@ int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal
155
154
int ret ;
156
155
157
156
if (creds == NULL ) {
158
- LOG_ERR ("Cannot set WiFi credentials, provided struct pointer cannot be NULL " );
157
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "set" , "credential not set " );
159
158
return - EINVAL ;
160
159
}
161
160
162
161
if (creds -> header .ssid_len > WIFI_SSID_MAX_LEN || creds -> header .ssid_len == 0 ) {
163
- LOG_ERR ("Cannot set WiFi credentials, SSID has invalid format" );
162
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "set" , " SSID has invalid format" );
164
163
return - EINVAL ;
165
164
}
166
165
@@ -170,15 +169,15 @@ int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal
170
169
if (idx == -1 ) {
171
170
idx = lookup_unused_idx ();
172
171
if (idx == -1 ) {
173
- LOG_ERR ("Cannot store WiFi credentials, no space left" );
172
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "store" , " no space left" );
174
173
ret = - ENOBUFS ;
175
174
goto exit ;
176
175
}
177
176
}
178
177
179
178
ret = wifi_credentials_store_entry (idx , creds , sizeof (struct wifi_credentials_personal ));
180
179
if (ret ) {
181
- LOG_ERR ("Failed to store WiFi credentials at index %d, err: %d" , idx , ret );
180
+ LOG_ERR ("Failed to %s WiFi credentials at index %d, err: %d" , "store " , idx , ret );
182
181
goto exit ;
183
182
}
184
183
@@ -200,20 +199,21 @@ int wifi_credentials_set_personal(const char *ssid, size_t ssid_len, enum wifi_s
200
199
struct wifi_credentials_header * header ;
201
200
202
201
if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0 ) {
203
- LOG_ERR ("Cannot set WiFi credentials, SSID has invalid format" );
202
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "set" , " SSID has invalid format" );
204
203
return - EINVAL ;
205
204
}
206
205
207
206
if (flags & WIFI_CREDENTIALS_FLAG_BSSID &&
208
207
(bssid_len != WIFI_MAC_ADDR_LEN || bssid == NULL )) {
209
- LOG_ERR ("Cannot set WiFi credentials, "
210
- "provided flags indicated BSSID, but no BSSID provided" );
208
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "set" ,
209
+ "provided flags indicated BSSID but no BSSID provided" );
211
210
return - EINVAL ;
212
211
}
213
212
214
213
if ((type != WIFI_SECURITY_TYPE_NONE && (password_len == 0 || password == NULL )) ||
215
214
(password_len > WIFI_CREDENTIALS_MAX_PASSWORD_LEN )) {
216
- LOG_ERR ("Cannot set WiFi credentials, password not provided or invalid" );
215
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "set" ,
216
+ "password not provided or invalid" );
217
217
return - EINVAL ;
218
218
}
219
219
@@ -246,9 +246,8 @@ int wifi_credentials_set_personal(const char *ssid, size_t ssid_len, enum wifi_s
246
246
break ;
247
247
}
248
248
default :
249
- LOG_ERR ("Cannot set WiFi credentials, "
250
- "provided security type %d is unsupported" ,
251
- type );
249
+ LOG_ERR ("Cannot %s WiFi credentials, provided security type %d is unsupported" ,
250
+ "set" , type );
252
251
return - ENOTSUP ;
253
252
}
254
253
@@ -269,18 +268,18 @@ int wifi_credentials_get_by_ssid_personal(const char *ssid, size_t ssid_len,
269
268
struct wifi_credentials_header * header ;
270
269
271
270
if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0 ) {
272
- LOG_ERR ("Cannot retrieve WiFi credentials, SSID has invalid format" );
271
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "retrieve" , " SSID has invalid format" );
273
272
return - EINVAL ;
274
273
}
275
274
276
275
if (bssid_buf_len != WIFI_MAC_ADDR_LEN || bssid_buf == NULL ) {
277
- LOG_ERR ("BSSID buffer needs to be provided" );
276
+ LOG_ERR ("%s buffer needs to be provided" , "BSSID " );
278
277
return - EINVAL ;
279
278
}
280
279
281
280
if (password_buf == NULL || password_buf_len > WIFI_CREDENTIALS_MAX_PASSWORD_LEN ||
282
281
password_buf_len == 0 ) {
283
- LOG_ERR ("WiFi password buffer needs to be provided" );
282
+ LOG_ERR ("%s buffer needs to be provided" , "WiFi password " );
284
283
return - EINVAL ;
285
284
}
286
285
@@ -318,7 +317,7 @@ int wifi_credentials_get_by_ssid_personal(const char *ssid, size_t ssid_len,
318
317
break ;
319
318
}
320
319
default :
321
- LOG_ERR ("Cannot get WiFi credentials, "
320
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "get" ,
322
321
"the requested credentials have invalid WIFI_SECURITY_TYPE" );
323
322
ret = - EPROTO ;
324
323
}
@@ -331,7 +330,7 @@ int wifi_credentials_delete_by_ssid(const char *ssid, size_t ssid_len)
331
330
int ret = 0 ;
332
331
333
332
if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0 ) {
334
- LOG_ERR ("Cannot delete WiFi credentials, SSID has invalid format" );
333
+ LOG_ERR ("Cannot %s WiFi credentials, %s" , "delete" , " SSID has invalid format" );
335
334
return - EINVAL ;
336
335
}
337
336
@@ -345,7 +344,7 @@ int wifi_credentials_delete_by_ssid(const char *ssid, size_t ssid_len)
345
344
346
345
ret = wifi_credentials_delete_entry (idx );
347
346
if (ret ) {
348
- LOG_ERR ("Failed to delete WiFi credentials index %d, err: %d" , idx , ret );
347
+ LOG_ERR ("Failed to %s WiFi credentials index %d, err: %d" , "delete " , idx , ret );
349
348
goto exit ;
350
349
}
351
350
@@ -393,8 +392,8 @@ int wifi_credentials_delete_all(void)
393
392
if (is_entry_used (i )) {
394
393
ret = wifi_credentials_delete_entry (i );
395
394
if (ret ) {
396
- LOG_ERR ("Failed to delete WiFi credentials index %d, err: %d" , i ,
397
- ret );
395
+ LOG_ERR ("Failed to %s WiFi credentials index %d, err: %d" ,
396
+ "delete" , i , ret );
398
397
break ;
399
398
}
400
399
0 commit comments