Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp844398pxt; Thu, 5 Aug 2021 13:08:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuJcIQlzvG9ariHKGSVlA6pdSAYZORCSJGvoNnm9Zonx3s9hPMV05UNNOo9q9W/Hmf2KX0 X-Received: by 2002:a05:6e02:1041:: with SMTP id p1mr223021ilj.125.1628194116964; Thu, 05 Aug 2021 13:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628194116; cv=none; d=google.com; s=arc-20160816; b=TZxC5Rdt7SIo8E3QPl1uv+maiCW7oJ9rJq8tz2gz51SioqL1nj1/uB9Z1/pjJ4+kwE QikcMAcoYU7cWruCDB/3e8+1R3TFBpdVemzU6yNWAURup7Q4EVZxSkR7ju1aoajq0las jZ5MygcvN2Tb3IsfLt9SLD+h5FHycqe8dyltytadouv0gOnvNPBQFETFjLVekpISiz/E nXVGyfqM8x13nPssdlpRvvl6IMcZIxZviUodxAJSiKULcbWyPFckZ8AZ7IHh0p20iZoN +vgj+sBrDgOULEgpUvm0S6r8D/r0P7OVD3CJ4Y+LxvURf7KO+rmO+L2YPzj2XRylhBMF OviA== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=lXlYpFTbOGHl5gJRMrjty8aLlrQrMvGcGevLFARYCOU=; b=vGMRxqf7AzHAWx5kWoZN4jPWlTuqktmXoLaJIl22qvY7WqG7DPQ6pLpGeo5XNA/byr wfkN35o9NdHYSfke9fdrGAmVLCrVOlUGt1+5A/A1zo4pQHZnPTJSSgvGkR9umHmJRB9u jGlJgvXRQESgHV0pbiTgS94jLIzq72mlifs3Tqkdjm5fcODP0KMZxLYYOG3ZcNNOpMEt LtMQ3wvssG74sY/oEoQjlI8Cp3qYETrWjkbc1bt+y1LJt7y0j1AuWAAWs0z/ZFicYpb1 Y1f2mlozc4eFaPB7yOtXVEqnP9kFVNMjrF29ZkRJiUQ5juWLjcy++I3vAiPKPwbeMZYk ZfJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si6424301jat.32.2021.08.05.13.08.22; Thu, 05 Aug 2021 13:08:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240027AbhHESEe (ORCPT + 99 others); Thu, 5 Aug 2021 14:04:34 -0400 Received: from smtprelay0012.hostedemail.com ([216.40.44.12]:60950 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231372AbhHESEd (ORCPT ); Thu, 5 Aug 2021 14:04:33 -0400 Received: from omf18.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 7511F180CE6B7; Thu, 5 Aug 2021 18:04:18 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf18.hostedemail.com (Postfix) with ESMTPA id 3A1692EBF91; Thu, 5 Aug 2021 18:04:17 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: prefer = {} initializations to = {0} From: Joe Perches To: Dan Carpenter , Andy Whitcroft , cocci Cc: Dwaipayan Ray , Lukas Bulwahn , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Date: Thu, 05 Aug 2021 11:04:15 -0700 In-Reply-To: <117021b44dc9ba570a0f48736d14a267a8701d0a.camel@perches.com> References: <20210805104353.GD26417@kili> <117021b44dc9ba570a0f48736d14a267a8701d0a.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: 3A1692EBF91 X-Spam-Status: No, score=1.60 X-Stat-Signature: uuzrtmw455mqebh8n9s3w4pphs8ayi33 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+EbY700CWuSN6m4MPwodG2UK3X8b9qYnI= X-HE-Tag: 1628186657-39462 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2021-08-05 at 05:27 -0700, Joe Perches wrote: > On Thu, 2021-08-05 at 13:43 +0300, Dan Carpenter wrote: > > The "= {};" style empty struct initializer is preferred over = {0}. > > It avoids the situation where the first struct member is a pointer and > > that generates a Sparse warning about assigning using zero instead of > > NULL. Also it's just nicer to look at. Perhaps a cocci script like the below could help too: $ cat zero_init_struct.cocci @@ identifier name; identifier t; @@ struct name t = { - 0 }; @@ identifier name; identifier t; identifier member; @@ struct name t = { ..., .member = { - 0 }, ..., };