Received: from eggs.gnu.org ([2001:4830:134:3::10]:42278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bq2p3-0000c3-AB for qemu-devel@nongnu.org; Fri, 30 Sep 2016 14:46:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bq2oy-0000wJ-Dy for qemu-devel@nongnu.org; Fri, 30 Sep 2016 14:46:13 -0400 References: <1475257895-10762-1-git-send-email-akanksha.dlf@gmail.com> From: Eric Blake Message-ID: <9d317b1b-9020-be71-e852-06e2d5021724@redhat.com> Date: Fri, 30 Sep 2016 13:46:06 -0500 MIME-Version: 1.0 In-Reply-To: <1475257895-10762-1-git-send-email-akanksha.dlf@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Njp7iAC1NUovKuclMDjfCVnKIEA0oGcXf" Subject: Re: [Qemu-devel] [PATCH] usb: Change *_exitfn return type from void to int List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Akanksha Srivastava , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, kraxel@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Njp7iAC1NUovKuclMDjfCVnKIEA0oGcXf From: Eric Blake To: Akanksha Srivastava , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, kraxel@redhat.com Message-ID: <9d317b1b-9020-be71-e852-06e2d5021724@redhat.com> Subject: Re: [Qemu-devel] [PATCH] usb: Change *_exitfn return type from void to int References: <1475257895-10762-1-git-send-email-akanksha.dlf@gmail.com> In-Reply-To: <1475257895-10762-1-git-send-email-akanksha.dlf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/30/2016 12:51 PM, Akanksha Srivastava wrote: > The *_exitfn functions cannot fail and should not be > returning int. > Suggested as a Bite-sized task > Signed-off-by: Akanksha Srivastava > --- > hw/usb/ccid-card-emulated.c | 4 ++-- > hw/usb/ccid-card-passthru.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c > index 3213f9f..abb2773 100644 > --- a/hw/usb/ccid-card-emulated.c > +++ b/hw/usb/ccid-card-emulated.c > @@ -547,7 +547,7 @@ static int emulated_initfn(CCIDCardState *base) > return 0; > } > =20 > -static int emulated_exitfn(CCIDCardState *base) > +static void emulated_exitfn(CCIDCardState *base) > { > EmulatedState *card =3D EMULATED_CCID_CARD(base); > VEvent *vevent =3D vevent_new(VEVENT_LAST, NULL, NULL); > @@ -564,7 +564,7 @@ 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; > + return; > } Ending a function that returns void with 'return' is redundant; just drop the return statement altogether if it is the last thing that can be reached. > =20 > static Property emulated_card_properties[] =3D { > diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c > index 2eacea7..2bd9cb2 100644 > --- a/hw/usb/ccid-card-passthru.c > +++ b/hw/usb/ccid-card-passthru.c > @@ -364,9 +364,9 @@ static int passthru_initfn(CCIDCardState *base) > return 0; > } > =20 > -static int passthru_exitfn(CCIDCardState *base) > +static void passthru_exitfn(CCIDCardState *base) > { > - return 0; > + return; > } And again. Since the callback does nothing, do you even need it to exist, or can you do further cleanups that allow the callback to be optional if it would otherwise be a no-op? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Njp7iAC1NUovKuclMDjfCVnKIEA0oGcXf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX7rLuAAoJEKeha0olJ0NqNwIH/RoCDwO9AwmWjWd5bDjwn9kb gNsUf/AhLfiCJUQhzzTqex2WTkpnjZLgrxwh0j/Lao/LAqWhGZLL8BPpU64aHkR7 xS4AvjgThAKs4e8LPihloaA9mOxuv/+DtZ+0sRIjDMfL+2TxfyEZHJXPXETjXSc2 ++7xTzguRUgIoKzpUHy3UlBpG7USDJeRUqH6Bxjo72cDaLvlgH+46ohfOVecIeoT UBiDOeJnIZHc7IhTCDZRkMrU6u5dlgOjt5qaBgXJcURCdre9Ijn+YzgzngteKgj1 3NbhhezQJj7QdGlcb9lhownX4tcYMwKdRJ+lsFMP5hSMgX6FTrSFEB7hQjS3E+Y= =jfx/ -----END PGP SIGNATURE----- --Njp7iAC1NUovKuclMDjfCVnKIEA0oGcXf--