aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ioemu/hw/pass-through.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ioemu/hw/pass-through.c')
-rw-r--r--tools/ioemu/hw/pass-through.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/ioemu/hw/pass-through.c b/tools/ioemu/hw/pass-through.c
index b445291874..7dd9588ba0 100644
--- a/tools/ioemu/hw/pass-through.c
+++ b/tools/ioemu/hw/pass-through.c
@@ -39,11 +39,10 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
{
char *token;
- token = strchr(*str, ',');
- if ( !token )
+ if ( !(*str) || !strchr(*str, ',') )
return 0;
- token++;
+ token = *str;
*seg = token_value(token);
token = strchr(token, ',') + 1;
*bus = token_value(token);
@@ -51,8 +50,9 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
*dev = token_value(token);
token = strchr(token, ',') + 1;
*func = token_value(token);
+ token = strchr(token, ',');
+ *str = token ? token + 1 : NULL;
- *str = token;
return 1;
}