usb: Change *_exitfn return type from int to void
The *_exitfn functions cannot fail and should not be returning int. This also removes the passthru_exitfn since this callback does nothing as of now. This was suggested as a Bite-sized task for code cleanup. Signed-off-by: Akanksha Srivastava <akanksha.dlf@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
		
							parent
							
								
									936c223051
								
							
						
					
					
						commit
						73f7fd8861
					
				| 
						 | 
					@ -547,7 +547,7 @@ static int emulated_initfn(CCIDCardState *base)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int emulated_exitfn(CCIDCardState *base)
 | 
					static void emulated_exitfn(CCIDCardState *base)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EmulatedState *card = EMULATED_CCID_CARD(base);
 | 
					    EmulatedState *card = EMULATED_CCID_CARD(base);
 | 
				
			||||||
    VEvent *vevent = vevent_new(VEVENT_LAST, NULL, NULL);
 | 
					    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->handle_apdu_mutex);
 | 
				
			||||||
    qemu_mutex_destroy(&card->vreader_mutex);
 | 
					    qemu_mutex_destroy(&card->vreader_mutex);
 | 
				
			||||||
    qemu_mutex_destroy(&card->event_list_mutex);
 | 
					    qemu_mutex_destroy(&card->event_list_mutex);
 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Property emulated_card_properties[] = {
 | 
					static Property emulated_card_properties[] = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -365,11 +365,6 @@ static int passthru_initfn(CCIDCardState *base)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int passthru_exitfn(CCIDCardState *base)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static VMStateDescription passthru_vmstate = {
 | 
					static VMStateDescription passthru_vmstate = {
 | 
				
			||||||
    .name = "ccid-card-passthru",
 | 
					    .name = "ccid-card-passthru",
 | 
				
			||||||
    .version_id = 1,
 | 
					    .version_id = 1,
 | 
				
			||||||
| 
						 | 
					@ -396,7 +391,6 @@ static void passthru_class_initfn(ObjectClass *klass, void *data)
 | 
				
			||||||
    CCIDCardClass *cc = CCID_CARD_CLASS(klass);
 | 
					    CCIDCardClass *cc = CCID_CARD_CLASS(klass);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cc->initfn = passthru_initfn;
 | 
					    cc->initfn = passthru_initfn;
 | 
				
			||||||
    cc->exitfn = passthru_exitfn;
 | 
					 | 
				
			||||||
    cc->get_atr = passthru_get_atr;
 | 
					    cc->get_atr = passthru_get_atr;
 | 
				
			||||||
    cc->apdu_from_guest = passthru_apdu_from_guest;
 | 
					    cc->apdu_from_guest = passthru_apdu_from_guest;
 | 
				
			||||||
    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 | 
					    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ typedef struct CCIDCardClass {
 | 
				
			||||||
    void (*apdu_from_guest)(CCIDCardState *card,
 | 
					    void (*apdu_from_guest)(CCIDCardState *card,
 | 
				
			||||||
                            const uint8_t *apdu,
 | 
					                            const uint8_t *apdu,
 | 
				
			||||||
                            uint32_t len);
 | 
					                            uint32_t len);
 | 
				
			||||||
    int (*exitfn)(CCIDCardState *card);
 | 
					    void (*exitfn)(CCIDCardState *card);
 | 
				
			||||||
    int (*initfn)(CCIDCardState *card);
 | 
					    int (*initfn)(CCIDCardState *card);
 | 
				
			||||||
} CCIDCardClass;
 | 
					} CCIDCardClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -508,14 +508,14 @@ 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);
 | 
					    CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (cc->exitfn) {
 | 
					    if (cc->exitfn) {
 | 
				
			||||||
        return cc->exitfn(card);
 | 
					        cc->exitfn(card);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return 0;
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int ccid_card_initfn(CCIDCardState *card)
 | 
					static int ccid_card_initfn(CCIDCardState *card)
 | 
				
			||||||
| 
						 | 
					@ -1279,7 +1279,6 @@ void ccid_card_card_inserted(CCIDCardState *card)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int ccid_card_exit(DeviceState *qdev)
 | 
					static int ccid_card_exit(DeviceState *qdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int ret = 0;
 | 
					 | 
				
			||||||
    CCIDCardState *card = CCID_CARD(qdev);
 | 
					    CCIDCardState *card = CCID_CARD(qdev);
 | 
				
			||||||
    USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
 | 
					    USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
 | 
				
			||||||
    USBCCIDState *s = USB_CCID_DEV(dev);
 | 
					    USBCCIDState *s = USB_CCID_DEV(dev);
 | 
				
			||||||
| 
						 | 
					@ -1287,9 +1286,9 @@ static int ccid_card_exit(DeviceState *qdev)
 | 
				
			||||||
    if (ccid_card_inserted(s)) {
 | 
					    if (ccid_card_inserted(s)) {
 | 
				
			||||||
        ccid_card_card_removed(card);
 | 
					        ccid_card_card_removed(card);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ret = ccid_card_exitfn(card);
 | 
					    ccid_card_exitfn(card);
 | 
				
			||||||
    s->card = NULL;
 | 
					    s->card = NULL;
 | 
				
			||||||
    return ret;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int ccid_card_init(DeviceState *qdev)
 | 
					static int ccid_card_init(DeviceState *qdev)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue