dahdi-sysfs-chan: Fix potential NULL pointer deref

Sometimes it is useful to look at compiler warnings:

dahdi-sysfs-chan.c:384:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]

And indeed, we could have de-referenced a NULL pointer here.

Change-Id: I4274e7a92ca6ee7e92c6adb713fb89ffe31b4c72
This commit is contained in:
Harald Welte 2022-04-24 19:41:42 +02:00
parent 5b4206edf3
commit 61b449a153
1 changed files with 2 additions and 1 deletions

View File

@ -381,10 +381,11 @@ static void fixed_devfiles_remove(void)
return;
for (i = 0; i < ARRAY_SIZE(fixed_minors); i++) {
void *d = fixed_minors[i].dev;
if (d && !IS_ERR(d))
if (d && !IS_ERR(d)) {
dahdi_dbg(DEVICES, "Removing fixed device file %s\n",
fixed_minors[i].name);
DEL_DAHDI_DEV(fixed_minors[i].minor);
}
}
}