From: Stijn Tintel Date: Tue, 18 Dec 2018 19:24:28 +0000 (+0200) Subject: kmodloader: load_modprobe: abort after 2 attempts X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=876c7f5bfb9b13d48e6d7960dd114082a0a95a6d;p=project%2Fubox.git kmodloader: load_modprobe: abort after 2 attempts The loop in load_modprobe causes dmesg to be flooded with errors when a module fails to load; e.g.: - gpio-nct5104d: Unsupported device 0xffff (246 times on x86 in Qemu) - jitterentropy: Initialization failed with host not compliant with requirements: 2 (229 times on brcm2708/bcm2708) On brcm2708/bcm2708 this also causes vmalloc allocation failures with kernel 4.14 when running headless. If kmod-drm-vc4 and kmod-video-bcm2835 are included in the image, they will be loaded before brcmfmac, and brcmfmac will fail to load: kmodloader: vmalloc: allocation failure: 249856 bytes, mode:0x14000c0(GFP_KERNEL), nodemask=(null) Break the loop after 2 failed attempts to fix these issues. Signed-off-by: Jo-Philipp Wich Signed-off-by: Stijn Tintel --- diff --git a/kmodloader.c b/kmodloader.c index 1b6488f..3196deb 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -637,14 +637,16 @@ static int load_modprobe(void) if (mn->is_alias) continue; m = mn->m; - if ((m->state == PROBE) && (!deps_available(m, 0))) { + if ((m->state == PROBE) && (!deps_available(m, 0)) && m->error < 2) { if (!insert_module(get_module_path(m->name), (m->opts) ? (m->opts) : (""))) { m->state = LOADED; m->error = 0; loaded++; continue; } - m->error = 1; + + if (++m->error > 1) + ULOG_ERR("failed to load %s\n", m->name); } if ((m->state == PROBE) || m->error)