aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-01-25 14:14:31 -0300
committerGerd Hoffmann <kraxel@redhat.com>2018-01-26 07:59:33 +0100
commitc7516699fc416ed836639dff12115f9d806bfc82 (patch)
treeb1bd0ecf075745f0c7ac04edc71df623841f71b8 /hw
parentcc847bfd16d894fd8c1a2ce25f31772f6cdbbc74 (diff)
usb-ccid: inline ccid_card_initfn() in ccid_card_realize()
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20180125171432.13554-3-f4bug@amsat.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/dev-smartcard-reader.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 0092493f4e..85f5f2247b 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -510,20 +510,6 @@ static void ccid_card_exitfn(CCIDCardState *card)
}
-static void ccid_card_initfn(CCIDCardState *card, Error **errp)
-{
- CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
- Error *local_err = NULL;
-
- if (cc->realize) {
- cc->realize(card, &local_err);
- if (local_err != NULL) {
- error_propagate(errp, local_err);
- return;
- }
- }
-}
-
static bool ccid_has_pending_answers(USBCCIDState *s)
{
return s->pending_answers_num > 0;
@@ -1302,6 +1288,7 @@ static int ccid_card_exit(DeviceState *qdev)
static void ccid_card_realize(DeviceState *qdev, Error **errp)
{
CCIDCardState *card = CCID_CARD(qdev);
+ CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
Error *local_err = NULL;
@@ -1315,10 +1302,12 @@ static void ccid_card_realize(DeviceState *qdev, Error **errp)
error_setg(errp, "usb-ccid card already full, not adding");
return;
}
- ccid_card_initfn(card, &local_err);
- if (local_err != NULL) {
- error_propagate(errp, local_err);
- return;
+ if (cc->realize) {
+ cc->realize(card, &local_err);
+ if (local_err != NULL) {
+ error_propagate(errp, local_err);
+ return;
+ }
}
s->card = card;
}