Skip to content

Commit 06c4426

Browse files
committed
Fix logical bug in request_firmware() function.
Issue: #151 Signed-off-by: Hans Petter Selasky <hps@selasky.org>
1 parent d775ee3 commit 06c4426

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

sys/compat/linuxkpi/gplv2/src/linux_firmware.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <linux/dmi.h>
1111
#undef firmware
1212

13-
MALLOC_DEFINE(M_LKPI_FW, "lkpifw", "linux kpi firmware");
13+
MALLOC_DEFINE(M_LKPI_FW, "lkpifw", "LinuxKPI firmware");
1414

1515
int
1616
request_firmware(const struct linux_firmware **lkfwp, const char *name,
@@ -24,8 +24,7 @@ request_firmware(const struct linux_firmware **lkfwp, const char *name,
2424

2525
*lkfwp = NULL;
2626
mapped_name = NULL;
27-
if ((lkfw = malloc(sizeof(*lkfw), M_LKPI_FW, M_NOWAIT)) == NULL)
28-
return (-ENOMEM);
27+
lkfw = malloc(sizeof(*lkfw), M_LKPI_FW, M_WAITOK);
2928

3029
retries = 0;
3130
fw = firmware_get(name);
@@ -52,9 +51,11 @@ request_firmware(const struct linux_firmware **lkfwp, const char *name,
5251
pause("fwwait", hz/4);
5352
fw = firmware_get(name);
5453
if (fw == NULL) {
55-
firmware_get(mapped_name);
56-
if (retries++ < 10)
57-
goto retry;
54+
fw = firmware_get(mapped_name);
55+
if (fw == NULL) {
56+
if (retries++ < 10)
57+
goto retry;
58+
}
5859
}
5960

6061
#ifdef __notyet__

0 commit comments

Comments
 (0)