Issue was detected by Coverity. --------------------------- ibsim-0.7/umad2sim/umad2sim.c:151: check_return: Calling "mkdir(dir, 493U)" without checking return value. This library function may fail and return an error code. --------------------------- Also covert the function into a void function, as none of callers checked the return value of make_path. Signed-off-by: Honggang Li <honli@xxxxxxxxxx> --- umad2sim/umad2sim.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/umad2sim/umad2sim.c b/umad2sim/umad2sim.c index b5a0532d0c72..46510b011cca 100644 --- a/umad2sim/umad2sim.c +++ b/umad2sim/umad2sim.c @@ -137,7 +137,7 @@ static void convert_sysfs_path(char *new_path, unsigned size, snprintf(new_path, size, "%s/%s", umad2sim_sysfs_prefix, old_path); } -static int make_path(char *path) +static void make_path(char *path) { char dir[1024]; char *p; @@ -148,14 +148,13 @@ static int make_path(char *path) p = strchr(p, '/'); if (p) *p = '\0'; - mkdir(dir, 0755); + if (mkdir(dir, 0755) && errno != EEXIST) + IBPANIC("Failed to make directory <%s>", dir); if (p) { *p = '/'; p++; } } while (p && p[0]); - - return 0; } static int file_printf(char *path, char *name, const char *fmt, ...) -- 2.15.0-rc1