From nobody Mon Feb 9 09:34:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492693978252261.3667662165418; Thu, 20 Apr 2017 06:12:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13DB875ECC; Thu, 20 Apr 2017 13:12:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D568179582; Thu, 20 Apr 2017 13:12:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5D12C5EC63; Thu, 20 Apr 2017 13:12:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3KD6Akb027875 for ; Thu, 20 Apr 2017 09:06:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 394E24DA37; Thu, 20 Apr 2017 13:06:10 +0000 (UTC) Received: from beluga.usersys.redhat.com (dhcp129-94.brq.redhat.com [10.34.129.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 878FB17110; Thu, 20 Apr 2017 13:06:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 13DB875ECC Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 13DB875ECC From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 20 Apr 2017 15:05:51 +0200 Message-Id: <11fe4671b6c0423e4d60df867a838a4469dbc67e.1492692115.git.eskultet@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH v2 01/10] nodedev: Make use of the compile-time missing enum in switch error X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 20 Apr 2017 13:12:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" So udevGetDeviceDetails was one those functions using an enum in a switch, but since it had a 'default' case, compiler didn't warn about an unhandled enum. Moreover, the error about an unsupported device type reported in the default case is unnecessary, since by the time we get there, udevGetDeviceType (which was called before) already made sure that any unrecognized device types had been handled properly. Signed-off-by: Erik Skultety --- src/node_device/node_device_udev.c | 45 +++++++++++++---------------------= ---- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index bcae444d8..591da8db2 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1043,50 +1043,35 @@ udevGetDeviceType(struct udev_device *device, static int udevGetDeviceDetails(struct udev_device *device, virNodeDeviceDefPtr def) { - int ret =3D 0; - switch (def->caps->data.type) { - case VIR_NODE_DEV_CAP_SYSTEM: - /* There's no libudev equivalent of system, so ignore it. */ - break; case VIR_NODE_DEV_CAP_PCI_DEV: - ret =3D udevProcessPCI(device, def); - break; + return udevProcessPCI(device, def); case VIR_NODE_DEV_CAP_USB_DEV: - ret =3D udevProcessUSBDevice(device, def); - break; + return udevProcessUSBDevice(device, def); case VIR_NODE_DEV_CAP_USB_INTERFACE: - ret =3D udevProcessUSBInterface(device, def); - break; + return udevProcessUSBInterface(device, def); case VIR_NODE_DEV_CAP_NET: - ret =3D udevProcessNetworkInterface(device, def); - break; + return udevProcessNetworkInterface(device, def); case VIR_NODE_DEV_CAP_SCSI_HOST: - ret =3D udevProcessSCSIHost(device, def); - break; + return udevProcessSCSIHost(device, def); case VIR_NODE_DEV_CAP_SCSI_TARGET: - ret =3D udevProcessSCSITarget(device, def); - break; + return udevProcessSCSITarget(device, def); case VIR_NODE_DEV_CAP_SCSI: - ret =3D udevProcessSCSIDevice(device, def); - break; + return udevProcessSCSIDevice(device, def); case VIR_NODE_DEV_CAP_STORAGE: - ret =3D udevProcessStorage(device, def); - break; + return udevProcessStorage(device, def); case VIR_NODE_DEV_CAP_SCSI_GENERIC: - ret =3D udevProcessSCSIGeneric(device, def); - break; + return udevProcessSCSIGeneric(device, def); case VIR_NODE_DEV_CAP_DRM: - ret =3D udevProcessDRMDevice(device, def); - break; - default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown device type %d"), def->caps->data.type); - ret =3D -1; + return udevProcessDRMDevice(device, def); + case VIR_NODE_DEV_CAP_SYSTEM: + case VIR_NODE_DEV_CAP_FC_HOST: + case VIR_NODE_DEV_CAP_VPORTS: + case VIR_NODE_DEV_CAP_LAST: break; } =20 - return ret; + return 0; } =20 =20 --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list