Skip to content

Commit 4a7c462

Browse files
alexdewarrichardweinberger
authored andcommitted
um: Remove some unnecessary NULL checks in vector_user.c
kfree() already checks for null pointers, so additional checking is unnecessary. Signed-off-by: Alex Dewar <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 237ce2e commit 4a7c462

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

arch/um/drivers/vector_user.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ static struct vector_fds *user_init_tap_fds(struct arglist *ifspec)
221221
return result;
222222
tap_cleanup:
223223
printk(UM_KERN_ERR "user_init_tap: init failed, error %d", fd);
224-
if (result != NULL)
225-
kfree(result);
224+
kfree(result);
226225
return NULL;
227226
}
228227

@@ -266,8 +265,7 @@ static struct vector_fds *user_init_hybrid_fds(struct arglist *ifspec)
266265
return result;
267266
hybrid_cleanup:
268267
printk(UM_KERN_ERR "user_init_hybrid: init failed");
269-
if (result != NULL)
270-
kfree(result);
268+
kfree(result);
271269
return NULL;
272270
}
273271

@@ -344,10 +342,8 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id)
344342
unix_cleanup:
345343
if (fd >= 0)
346344
os_close_file(fd);
347-
if (remote_addr != NULL)
348-
kfree(remote_addr);
349-
if (result != NULL)
350-
kfree(result);
345+
kfree(remote_addr);
346+
kfree(result);
351347
return NULL;
352348
}
353349

@@ -382,8 +378,7 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec)
382378
return result;
383379
raw_cleanup:
384380
printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err);
385-
if (result != NULL)
386-
kfree(result);
381+
kfree(result);
387382
return NULL;
388383
}
389384

0 commit comments

Comments
 (0)