Skip to contentSkip to conversation

Change return type of functions that are named *_exit or *_exitfn in hw/usb from int to void

PATCH In review Nutan Shinde 1 participant 1 message Apr 12, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 5/5 Change return type of functions that are named *_exit or *_exitfn in hw/usb from int to void

This change is required because the return type of exit(error) function is not used.
This patch only has changes for files in hw/usb package.

---
 hw/usb/ccid-card-emulated.c   |  3 +--
 hw/usb/ccid.h                 |  2 +-
 hw/usb/dev-smartcard-reader.c | 11 ++++-------
 3 files changed, 6 insertions(+), 10 deletions(-)
hw/usb/ccid-card-emulated.c +1 -2
index 9ddd5ad..9962786 100644
@@ -547,7 +547,7 @@ static int emulated_initfn(CCIDCardState *base)
     return 0;
 }
 
-static int emulated_exitfn(CCIDCardState *base)
+static void emulated_exitfn(CCIDCardState *base)
 {
     EmulatedState *card = EMULATED_CCID_CARD(base);
     VEvent *vevent = vevent_new(VEVENT_LAST, NULL, NULL);
@@ -564,7 +564,6 @@ static int emulated_exitfn(CCIDCardState *base)
     qemu_mutex_destroy(&card->handle_apdu_mutex);
     qemu_mutex_destroy(&card->vreader_mutex);
     qemu_mutex_destroy(&card->event_list_mutex);
-    return 0;
 }
 
 static Property emulated_card_properties[] = {
hw/usb/ccid.h +1 -1
index 9334da8..1f07011 100644
@@ -33,7 +33,7 @@ typedef struct CCIDCardClass {
     void (*apdu_from_guest)(CCIDCardState *card,
                             const uint8_t *apdu,
                             uint32_t len);
-    int (*exitfn)(CCIDCardState *card);
+    void (*exitfn)(CCIDCardState *card);
     int (*initfn)(CCIDCardState *card);
 } CCIDCardClass;
 
hw/usb/dev-smartcard-reader.c +0 -0
index af4b851..aeb357f 100644
@@ -508,14 +508,13 @@ static void ccid_card_apdu_from_guest(CCIDCardState

*card,

     }

}

-static int ccid_card_exitfn(CCIDCardState *card) +static void ccid_card_exitfn(CCIDCardState *card)

 {
     CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);

     if (cc->exitfn) {
-        return cc->exitfn(card);
+        cc->exitfn(card);
     }

- return 0;
}

static int ccid_card_initfn(CCIDCardState *card)
@@ -1277,9 +1276,8 @@ void ccid_card_card_inserted(CCIDCardState *card)

     ccid_on_slot_change(s, true);

}

-static int ccid_card_exit(DeviceState *qdev)
+static void ccid_card_exit(DeviceState *qdev)
{

-    int ret = 0;
     CCIDCardState *card = CCID_CARD(qdev);
     USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
     USBCCIDState *s = USB_CCID_DEV(dev);
@@ -1287,9 +1285,8 @@ static int ccid_card_exit(DeviceState *qdev)
     if (ccid_card_inserted(s)) {
         ccid_card_card_removed(card);
     }
-    ret = ccid_card_exitfn(card);
+    ccid_card_exitfn(card);
     s->card = NULL;

- return ret;
}

static int ccid_card_init(DeviceState *qdev)
--
1.9.1