From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adpqQ-0006Xd-0P for qemu-devel@nongnu.org; Wed, 09 Mar 2016 20:56:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adpqM-0004WW-OA for qemu-devel@nongnu.org; Wed, 09 Mar 2016 20:56:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adpqM-0004WR-IQ for qemu-devel@nongnu.org; Wed, 09 Mar 2016 20:56:50 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 167BFC00F1DF for ; Thu, 10 Mar 2016 01:56:50 +0000 (UTC) Date: Thu, 10 Mar 2016 09:56:47 +0800 From: Fam Zheng Message-ID: <20160310015647.GG23632@ad.usersys.redhat.com> References: <1457503813-31631-1-git-send-email-peterx@redhat.com> <1457503813-31631-3-git-send-email-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1457503813-31631-3-git-send-email-peterx@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/2] usb: trivial cleanup for usb_mtp_add_str List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com On Wed, 03/09 14:10, Peter Xu wrote: > Remove useless var "ret". > > Signed-off-by: Peter Xu > --- > hw/usb/dev-mtp.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c > index cf63fd0..38cc4fc 100644 > --- a/hw/usb/dev-mtp.c > +++ b/hw/usb/dev-mtp.c > @@ -719,10 +719,8 @@ static void usb_mtp_add_str(MTPData *data, const char *str) > { > uint32_t len = strlen(str)+1; > wchar_t *wstr = g_malloc(sizeof(wchar_t) * len); > - size_t ret; > > - ret = mbstowcs(wstr, str, len); > - if (ret == -1) { > + if (mbstowcs(wstr, str, len) == -1) { > usb_mtp_add_wstr(data, L"Oops"); > } else { > usb_mtp_add_wstr(data, wstr); > -- > 2.4.3 > > The old way has no problem, no need to clean up, IMO. Fam