diff options
author | Warner Losh <imp@FreeBSD.org> | 2022-11-29 20:02:40 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2022-11-29 20:10:16 +0000 |
commit | b60164c9f4d823b3e9fbcb733f92d181c704f415 (patch) | |
tree | 1c5238ffa6e3042e9ef62a8df5e41ebf9b99ef8f /stand/libofw/devicename.c | |
parent | bc9a5b049797fb7484dc1448f5d806955499f1f0 (diff) | |
download | src-b60164c9f4d823b3e9fbcb733f92d181c704f415.tar.gz src-b60164c9f4d823b3e9fbcb733f92d181c704f415.zip |
Diffstat (limited to 'stand/libofw/devicename.c')
-rw-r--r-- | stand/libofw/devicename.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/stand/libofw/devicename.c b/stand/libofw/devicename.c index 11c0a1719ff3..353675db6b1f 100644 --- a/stand/libofw/devicename.c +++ b/stand/libofw/devicename.c @@ -43,27 +43,24 @@ static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); int ofw_getdev(void **vdev, const char *devspec, const char **path) { - struct ofw_devdesc **dev = (struct ofw_devdesc **)vdev; - int rv; + struct ofw_devdesc **dev = (struct ofw_devdesc **)vdev; + int rv; - /* - * If it looks like this is just a path and no - * device, go with the current device. - */ - if ((devspec == NULL) || - ((strchr(devspec, '@') == NULL) && - (strchr(devspec, ':') == NULL))) { - - if (((rv = ofw_parsedev(dev, getenv("currdev"), NULL)) == 0) && - (path != NULL)) - *path = devspec; - return(rv); - } + /* + * If it looks like this is just a path and no device, go with the current + * device. + */ + if (devspec == NULL || strpbrk(devspec, ":@") == NULL) { + if (((rv = ofw_parsedev(dev, getenv("currdev"), NULL)) == 0) && + (path != NULL)) + *path = devspec; + return(rv); + } - /* - * Try to parse the device name off the beginning of the devspec - */ - return(ofw_parsedev(dev, devspec, path)); + /* + * Try to parse the device name off the beginning of the devspec + */ + return(ofw_parsedev(dev, devspec, path)); } /* |