The driver suffix might be NULL on some platforms. Perform the matching
only when there is a suffix.
if (strncmp(dirent->d_name, prefix, prefix_len) != 0)
continue;
/* match the suffix */
- p = dirent->d_name + dirent_len - suffix_len;
- if (p < dirent->d_name || strcmp(p, suffix) != 0)
- continue;
+ if (suffix) {
+ p = dirent->d_name + dirent_len - suffix_len;
+ if (p < dirent->d_name || strcmp(p, suffix) != 0)
+ continue;
+ }
/* make a full path and load the driver */
if (len + dirent_len + 1 <= sizeof(path)) {