diff mbox series

[PATCH-for-4.1?,5/7] vl: Use qemu_strtoi() instead of strtol()

Message ID 20190712133928.21394-6-philmd@redhat.com
State New
Headers show
Series vl: Allow building with CONFIG_BLUETOOTH disabled | expand

Commit Message

Philippe Mathieu-Daudé July 12, 2019, 1:39 p.m. UTC
Since we'll move this code around, fix this checkpatch warning
first:

  ERROR: consider using qemu_strtol in preference to strtol

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 vl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/vl.c b/vl.c
index 96de4f74b9..c7f4d01c99 100644
--- a/vl.c
+++ b/vl.c
@@ -978,8 +978,7 @@  static struct bt_device_s *bt_device_add(const char *opt)
     pstrcpy(devname, MIN(sizeof(devname), len), opt);
 
     if (endp) {
-        vlan_id = strtol(endp + 6, &endp, 0);
-        if (*endp) {
+        if (qemu_strtoi(endp + 6, (const char **)&endp, 0, &vlan_id) < 0) {
             error_report("unrecognised bluetooth vlan Id");
             return 0;
         }
@@ -1019,8 +1018,7 @@  static int bt_parse(const char *opt)
         if (!*endp || *endp == ',') {
             if (*endp) {
                 if (strstart(endp, ",vlan=", &p)) {
-                    vlan = strtol(p, (char **) &endp, 0);
-                    if (*endp) {
+                    if (qemu_strtoi(p, &endp, 0, &vlan) < 0) {
                         error_report("bad scatternet '%s'", p);
                         return 1;
                     }