Skip to content

Commit 09e8e12

Browse files
committed
Don't do "modprobe mali" is we already have /dev/mali
The modprobe tool may be not available (for example in Android). Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
1 parent a1966fd commit 09e8e12

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

load_mali_kernel_module.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#include <stdlib.h>
2525
#include <stdio.h>
2626
#include <string.h>
27+
#include <sys/types.h>
28+
#include <sys/stat.h>
29+
#include <fcntl.h>
2730

2831
static void check_kernel_cmdline(void)
2932
{
@@ -47,8 +50,16 @@ static void check_kernel_cmdline(void)
4750

4851
void load_mali_kernel_module(void)
4952
{
53+
int fd;
54+
5055
check_kernel_cmdline();
5156

57+
fd = open("/dev/mali", O_RDWR);
58+
if (fd != -1) {
59+
close(fd);
60+
return;
61+
}
62+
5263
if (system("modprobe mali >/dev/null 2>&1")) {
5364
fprintf(stderr, "Failed to 'modprobe mali'.\n");
5465
abort();

0 commit comments

Comments
 (0)