From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTs3P-0003Ai-VG for qemu-devel@nongnu.org; Wed, 18 Jan 2017 10:21:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTs3M-0004Ot-6B for qemu-devel@nongnu.org; Wed, 18 Jan 2017 10:21:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cTs3L-0004OE-WD for qemu-devel@nongnu.org; Wed, 18 Jan 2017 10:21:36 -0500 Date: Wed, 18 Jan 2017 17:21:32 +0200 From: "Michael S. Tsirkin" Message-ID: <20170118171932-mutt-send-email-mst@kernel.org> References: <1484633936-25344-1-git-send-email-caoj.fnst@cn.fujitsu.com> <1484633936-25344-5-git-send-email-caoj.fnst@cn.fujitsu.com> <587DBEBE.4070409@cn.fujitsu.com> <20170117175708-mutt-send-email-mst@kernel.org> <587F0B3F.1040300@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <587F0B3F.1040300@cn.fujitsu.com> Subject: Re: [Qemu-devel] [PATCH v9 04/11] msix: check msix_init's return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin Cc: qemu-devel@nongnu.org, dmitry@daynix.com, Jason Wang , jiri@resnulli.us, Markus Armbruster , Marcel Apfelbaum On Wed, Jan 18, 2017 at 02:29:19PM +0800, Cao jin wrote: > > > On 01/18/2017 12:01 AM, Michael S. Tsirkin wrote: > > On Tue, Jan 17, 2017 at 02:50:38PM +0800, Cao jin wrote: > >> forget to cc maintainers in this new patch > >> > >> On 01/17/2017 02:18 PM, Cao jin wrote: > >>> Doesn't do it for megasas & hcd-xhci, later patches will fix them. > >>> > >>> Signed-off-by: Cao jin > > > > I don't like this one, frankly. That's a bunch of code duplication. > > Yes, code duplication, seems inevitable if move the asserts into a > separate patch. > > > I suspect vfio is the only one who might reasonably get EINVAL here. > > So how about e.g. msix_validate_and_init that doesn't assert and use that > > from vfio, then switch msix_init to assert instead? > > > > Not sure if I get your idea. Do you mean: do param check via assert in > msix_init(), so that no need check its returned error outside, and > introduce new api msix_validate_and_init(same content as msix_init, > except param check) dedicated to vfio? Something like this. > If I understand you right, the way we do param check for msi_init[*] & > msix_init will be inconsistent. Right, we should consolidate these for msi too. > [*] patch: msi_init: convert assert to return -errno > > -- > Sincerely, > Cao jin >