Skip to content

Commit

Permalink
Don't do "modprobe mali" is we already have /dev/mali
Browse files Browse the repository at this point in the history
The modprobe tool may be not available (for example in Android).

Signed-off-by: Siarhei Siamashka <[email protected]>
  • Loading branch information
ssvb committed Dec 5, 2015
1 parent a1966fd commit 09e8e12
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions load_mali_kernel_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

static void check_kernel_cmdline(void)
{
Expand All @@ -47,8 +50,16 @@ static void check_kernel_cmdline(void)

void load_mali_kernel_module(void)
{
int fd;

check_kernel_cmdline();

fd = open("/dev/mali", O_RDWR);
if (fd != -1) {
close(fd);
return;
}

if (system("modprobe mali >/dev/null 2>&1")) {
fprintf(stderr, "Failed to 'modprobe mali'.\n");
abort();
Expand Down

0 comments on commit 09e8e12

Please sign in to comment.