Received: from eggs.gnu.org ([2001:4830:134:3::10]:57793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDOx0-00046t-Au for qemu-devel@nongnu.org; Wed, 24 May 2017 01:35:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDOwx-0006eO-6g for qemu-devel@nongnu.org; Wed, 24 May 2017 01:35:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46274) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDOwx-0006dQ-0G for qemu-devel@nongnu.org; Wed, 24 May 2017 01:35:11 -0400 From: Markus Armbruster References: <29c33313efd2ee4f7bf3abb71a4809582891f408.1495508197.git.maozy.fnst@cn.fujitsu.com> <87wp97hqi4.fsf@dusky.pond.sub.org> <4011bf08-8686-f2ae-474e-004aa603cc0e@amsat.org> Date: Wed, 24 May 2017 07:35:04 +0200 In-Reply-To: <4011bf08-8686-f2ae-474e-004aa603cc0e@amsat.org> ("Philippe =?utf-8?Q?Mathieu-Daud=C3=A9=22's?= message of "Wed, 24 May 2017 01:43:04 -0300") Message-ID: <87r2zeu8af.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Cc: qemu-devel@nongnu.org, Mao Zhongyi , jiri@resnulli.us, jasowang@redhat.com, "Michael S. Tsirkin" , Marcel Apfelbaum Philippe Mathieu-Daud=C3=A9 writes: > Hi Markus, > > On 05/23/2017 06:27 AM, Markus Armbruster wrote: > [...] >> There's one more cleanup opportunity: >> > [...] >>> if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf,= size)) { >>> return NULL; >>> } >> >> None of the pci_dma_read() calls outside rocker check the return value. >> Just as well, because it always returns 0. Please clean this up in a >> separate followup patch. > > It may be the correct way to do it but this sounds like we are missing > something somewhere... pci_dma_read() calls pci_dma_rw() which always > returns 0. Why not let it returns void? It is inlined and never used > by address. Else we should document why returning 0 is correct, and > what is the reason to not use a void prototype. > > pci_dma_rw() calls dma_memory_rw() which does return a boolean value, > false on success (MEMTX_OK) and true on error > (MEMTX_ERROR/DECODE_ERROR) PCI question. Michael, Marcel?