diff options
-rw-r--r-- | drivers/firmware/dmi_scan.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 938100f14b16..3a2ccb09e2f8 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -429,7 +429,7 @@ static bool dmi_matches(const struct dmi_system_id *dmi) | |||
429 | for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) { | 429 | for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) { |
430 | int s = dmi->matches[i].slot; | 430 | int s = dmi->matches[i].slot; |
431 | if (s == DMI_NONE) | 431 | if (s == DMI_NONE) |
432 | continue; | 432 | break; |
433 | if (dmi_ident[s] | 433 | if (dmi_ident[s] |
434 | && strstr(dmi_ident[s], dmi->matches[i].substr)) | 434 | && strstr(dmi_ident[s], dmi->matches[i].substr)) |
435 | continue; | 435 | continue; |
@@ -440,6 +440,15 @@ static bool dmi_matches(const struct dmi_system_id *dmi) | |||
440 | } | 440 | } |
441 | 441 | ||
442 | /** | 442 | /** |
443 | * dmi_is_end_of_table - check for end-of-table marker | ||
444 | * @dmi: pointer to the dmi_system_id structure to check | ||
445 | */ | ||
446 | static bool dmi_is_end_of_table(const struct dmi_system_id *dmi) | ||
447 | { | ||
448 | return dmi->matches[0].slot == DMI_NONE; | ||
449 | } | ||
450 | |||
451 | /** | ||
443 | * dmi_check_system - check system DMI data | 452 | * dmi_check_system - check system DMI data |
444 | * @list: array of dmi_system_id structures to match against | 453 | * @list: array of dmi_system_id structures to match against |
445 | * All non-null elements of the list must match | 454 | * All non-null elements of the list must match |
@@ -457,7 +466,7 @@ int dmi_check_system(const struct dmi_system_id *list) | |||
457 | int count = 0; | 466 | int count = 0; |
458 | const struct dmi_system_id *d; | 467 | const struct dmi_system_id *d; |
459 | 468 | ||
460 | for (d = list; d->ident; d++) | 469 | for (d = list; !dmi_is_end_of_table(d); d++) |
461 | if (dmi_matches(d)) { | 470 | if (dmi_matches(d)) { |
462 | count++; | 471 | count++; |
463 | if (d->callback && d->callback(d)) | 472 | if (d->callback && d->callback(d)) |
@@ -484,7 +493,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list) | |||
484 | { | 493 | { |
485 | const struct dmi_system_id *d; | 494 | const struct dmi_system_id *d; |
486 | 495 | ||
487 | for (d = list; d->ident; d++) | 496 | for (d = list; !dmi_is_end_of_table(d); d++) |
488 | if (dmi_matches(d)) | 497 | if (dmi_matches(d)) |
489 | return d; | 498 | return d; |
490 | 499 | ||