From nobody Tue Feb 10 01:35:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652376840; cv=none; d=zohomail.com; s=zohoarc; b=Le73QXyWD8P5dXs3iZV1rgg8QX84MyTUND6PEOf1VGYcDwPNzBH51DJ1cuQVFn7lwxpNevLPHB4TczidJaRMfYae9KCoje1wmBfAT1BqMsXh+saApL0o/IGSQ9OvGlf+pYQy6EVVMks/Eg0RVMiLC13GkoTTy2Msr3KciRZTTsI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652376840; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gEDD5oFIVt6h6UD/wNZ8p021ml7rtZI2Tu/KBv66GSM=; b=XqYsKXWRFBqUJmn6B4Etn1ptHKm4u7zEFNFJOOQ/sHtVBWEas7Dp4xoQcC7onPiLtoLrrPMd+hpgSKJgUq4PWOqB5WVir1jp02pT+DaaG0asD7UuaO5H/8PN+ugaQ0QqeqUvsB+hKFOeY/eZtOmuKAB0yi7GAB1h0Gr2Vc2NoXg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1652376840842308.5297058304684; Thu, 12 May 2022 10:34:00 -0700 (PDT) Received: from localhost ([::1]:50840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npChL-0005n1-J3 for importer@patchew.org; Thu, 12 May 2022 13:33:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npCZ4-0004vG-Ns for qemu-devel@nongnu.org; Thu, 12 May 2022 13:25:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npCZ1-00055l-1j for qemu-devel@nongnu.org; Thu, 12 May 2022 13:25:25 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-142-mYB919b7M3WdsfUTIEjb1Q-1; Thu, 12 May 2022 13:25:19 -0400 Received: by mail-ed1-f72.google.com with SMTP id s29-20020a50ab1d000000b00427e495f00cso3476440edc.14 for ; Thu, 12 May 2022 10:25:19 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v17-20020a170906489100b006f3ef214dd4sm2235283ejq.58.2022.05.12.10.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 10:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652376321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gEDD5oFIVt6h6UD/wNZ8p021ml7rtZI2Tu/KBv66GSM=; b=WV3rha6iqSp2HMebwtpjI5fS1b9X6DxahXe/vwH0fw/eXb97TSLz5IflcVG35Csk09gwOu PP7lLg/t6XHotr1MEQer7cpfEh7meHQlvTTafnY1OOreGAzt+ZylrXj6Hno6oNJju/9YG9 mKn3ziCB+2Lgzg0UWSUyOTyfFHSxQqE= X-MC-Unique: mYB919b7M3WdsfUTIEjb1Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gEDD5oFIVt6h6UD/wNZ8p021ml7rtZI2Tu/KBv66GSM=; b=KpHVDrWSeFhEptPQIpGlyLYkPfM/L6D+vecp4dwaNrCDpsKKVjGpZjk2GTO0P5eaIu vBPh9CA0vAW6B8RTW0u3mSQ0Jd8TDqEtJI2yRHBmZcTcoEk/uclbFSKBwIf13NyrBcfM 21/wQnFAvkz2Qh2cpEd2gQ4XmtxLYXRJW2obRAdJi5BLxAlU2F8wC2pEqXv7Ag5rVUN8 N0x4dY6LKrEL2O4Nv6mqKB+qR8VriNB6n98HyjdpH20O34roPD7r1O0amGAJPjBZVWlQ 9J5mtGl8LUAZq7o8x016YmFrzvI7KZnl1pxnG3zeD4QK12ObBz5s3q4I0LGSF5u9hjmj rClg== X-Gm-Message-State: AOAM531kSxIgzYx61LbKTB2jQGaS68KaEuWHz6zhHUCdW5P0L+P5Bm81 rZ2hhUrIgiGckXRc+eqNBAwRNGcHCEiSE+1wVT1qhiKU4nnhn/GQ/RPp/b2PO73KvA5MSPN8LnX DiLzV6XoK1f9NsRqyWV6LJ91H2/jAk0qtktSbNRD09aTkt2S2TTl73IVHOp8QP8HEItM= X-Received: by 2002:aa7:c0c4:0:b0:425:c776:6f17 with SMTP id j4-20020aa7c0c4000000b00425c7766f17mr35696235edp.131.1652376317948; Thu, 12 May 2022 10:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRt0FIBV3RtMIUU6kz+trc2o3GzYLlE3M9gJ5iLJW/gE+gixWjrMIXjHZftMNWeGobjXpoYA== X-Received: by 2002:aa7:c0c4:0:b0:425:c776:6f17 with SMTP id j4-20020aa7c0c4000000b00425c7766f17mr35696210edp.131.1652376317694; Thu, 12 May 2022 10:25:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/27] checkpatch: fix g_malloc check Date: Thu, 12 May 2022 19:24:42 +0200 Message-Id: <20220512172505.1065394-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220512172505.1065394-1-pbonzini@redhat.com> References: <20220512172505.1065394-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652376842796100001 Content-Type: text/plain; charset="utf-8" Use the string equality operator "eq", and ensure that $1 is defined by using "(try|)" instead of "(try)?". The alternative "((?:try)?)" is longer and less readable. Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4763d02ae7..d900d18048 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2831,8 +2831,8 @@ sub process { } =20 # check for pointless casting of g_malloc return - if ($line =3D~ /\*\s*\)\s*g_(try)?(m|re)alloc(0?)(_n)?\b/) { - if ($2 =3D=3D 'm') { + if ($line =3D~ /\*\s*\)\s*g_(try|)(m|re)alloc(0?)(_n)?\b/) { + if ($2 eq 'm') { ERROR("unnecessary cast may hide bugs, use g_$1new$3 instead\n" . $her= ecurr); } else { ERROR("unnecessary cast may hide bugs, use g_$1renew$3 instead\n" . $h= erecurr); --=20 2.36.0