git: 3ececb0f35b9 - stable/13 - stand: dev can't be NULL in default_prasedev
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jan 2023 22:14:36 UTC
The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3ececb0f35b91948a1122b4df87fc952d31ade8a commit 3ececb0f35b91948a1122b4df87fc952d31ade8a Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2023-01-13 22:44:23 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-01-24 21:49:47 +0000 stand: dev can't be NULL in default_prasedev We pass in the address of a variable to store this value always in the only place that calls this function, so there is no need to test for NULL. Sponsored by: Netflix Notied by: tsoome in D38041 (cherry picked from commit 4883f347f6ed9a61f9789a3842077580250ebf44) --- stand/libsa/dev.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/stand/libsa/dev.c b/stand/libsa/dev.c index 6d1834c8a14a..e76be6cd0eb0 100644 --- a/stand/libsa/dev.c +++ b/stand/libsa/dev.c @@ -100,10 +100,7 @@ default_parsedev(struct devdesc **dev, const char *devspec, idev->d_unit = unit; if (path != NULL) *path = (*cp == 0) ? cp : cp + 1; - if (dev != NULL) /* maybe this can be required? */ - *dev = idev; - else - free(idev); + *dev = idev; return (0); fail: free(idev);