From patchwork Wed Feb 8 14:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 54442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3475593wrn; Wed, 8 Feb 2023 06:09:16 -0800 (PST) X-Google-Smtp-Source: AK7set9oLmN0GwmUML4fOTDXsOojpIweRT4Rgilt1L7gyez0kM3WMZ0L+VK8vU99uhD+g/5Zh62P X-Received: by 2002:a05:6a20:7f94:b0:b8:b9e7:6d4 with SMTP id d20-20020a056a207f9400b000b8b9e706d4mr10230784pzj.0.1675865356347; Wed, 08 Feb 2023 06:09:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865356; cv=none; d=google.com; s=arc-20160816; b=Zne8mq+MNm/ntQ+DX2CA2FgS/XcFlv/Q4l5PVJVmuVhfVDvN/QDeUxz/RKkKZ6H9So pxvWnNKSXfGxha73WmaUM5EK0+z5BnNTfiZkVdhDcVuSJAaCw23aINvaWESA6p/XnYJ6 SmsTzxTR1NlbRhLDbXpWsxdMU+CX5vlAQ3LsiRrsVMPjFuXuLDHyljfKaesK/xbCc6F9 re36cQ3Ain3RtBzqiY9ThaJtq6WFlOSbuW0Qti6taXh0qPR9akgv39sLw3TnyCFhfZ3D oMWaBzUZsJzj+Hsr7R1bo+8m9FaGlj557/qK5h8qsIWc3Nrw8CxzXeYiUUjiERZMDwlV VN+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B/oxBv4GyMlmg4LCOb2+pqMxLhVHvEGbOFN4G7DG1xk=; b=0n4rvWycjdH+WAWPkS8ph/2nRgHIlk3DjKikGkx3SQ5WIitKoyDQu70JBRkj48wpAS 9MLbTG61ipAFLzHdAkv/kX0u90842OGpJjeMaoJHNvDhD5Vs6Cc0SJgeZN2Mx8rCv4W5 yoS5xNWx8NfetS11n/Ftpww5t52oJ7oPPUrpzfJ3tgdwH1HCg5MCsHdOLHEWNgQKJFUt J5mWpbVZvTX9J5cWq1nQTgTJdJrgmeh6XI3WD1ZQ9fmstLlRpvleLBQeQIaEgFZLBVnC i07FNpQgELQVD8fb6fGRsZ5CVNvj3GW/Ok9zExdoxAkyAH3iGVkBu+B9QqEkbgREDcNT 8WtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DBSYPXxa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a633e0d000000b004fb14c87db5si5917887pga.228.2023.02.08.06.09.02; Wed, 08 Feb 2023 06:09:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DBSYPXxa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230498AbjBHODP (ORCPT + 99 others); Wed, 8 Feb 2023 09:03:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231395AbjBHODG (ORCPT ); Wed, 8 Feb 2023 09:03:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B23E741092 for ; Wed, 8 Feb 2023 06:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675864901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B/oxBv4GyMlmg4LCOb2+pqMxLhVHvEGbOFN4G7DG1xk=; b=DBSYPXxaOpceWBdCD02s8sjLYG7xOAqnVPy/VB1WFkyUfEZg/jQ3jabpIfiGt51gxlTujf WPmU6elDPeCw/wB2PUyRj1Q5sGdY/NxBwr+6qOBM0ZDzEidAquuYSS4m0mkIykdyfsAEgS em15pOISGZVNdrC2tmS34AsFnBl6fUU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-175-lS0izmB0OKqVYfkJTapWdw-1; Wed, 08 Feb 2023 09:01:39 -0500 X-MC-Unique: lS0izmB0OKqVYfkJTapWdw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 627871C08976; Wed, 8 Feb 2023 14:01:38 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 976E8140EBF4; Wed, 8 Feb 2023 14:01:34 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christian Borntraeger , Janosch Frank , David Hildenbrand , Gavin Shan , Steven Price , Cornelia Huck Subject: [PATCH v2 5/6] KVM: Standardize on "int" return types instead of "long" in kvm_main.c Date: Wed, 8 Feb 2023 15:01:04 +0100 Message-Id: <20230208140105.655814-6-thuth@redhat.com> In-Reply-To: <20230208140105.655814-1-thuth@redhat.com> References: <20230208140105.655814-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757272192192435063?= X-GMAIL-MSGID: =?utf-8?q?1757272192192435063?= KVM functions use "long" return values for functions that are wired up to "struct file_operations", but otherwise use "int" return values for functions that can return 0/-errno in order to avoid unintentional divergences between 32-bit and 64-bit kernels. Some code still uses "long" in unnecessary spots, though, which can cause a little bit of confusion and unnecessary size casts. Let's change these spots to use "int" types, too. Signed-off-by: Thomas Huth --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 9c60384b5ae0..cd46467252a9 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4475,7 +4475,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm, return 0; } -static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) +static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) { switch (arg) { case KVM_CAP_USER_MEMORY: @@ -5053,7 +5053,7 @@ static int kvm_dev_ioctl_create_vm(unsigned long type) static long kvm_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { - long r = -EINVAL; + int r = -EINVAL; switch (ioctl) { case KVM_GET_API_VERSION: