Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp323236pxb; Mon, 2 Nov 2020 23:55:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuQ5kSbF+vIK92dvLA0QhFKjweVdaoO+V7P3K5bO2HhZnGVvd9yMIHOMeW++pfSOQgl0Gb X-Received: by 2002:a05:6402:4cd:: with SMTP id n13mr15551518edw.127.1604390128581; Mon, 02 Nov 2020 23:55:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604390128; cv=none; d=google.com; s=arc-20160816; b=KumQcQSp98IBMzmBPARoDcdGjRFup4tPiYVXJfiOKYy0SOSpzNSN4rxty7dpGsrteP 8ZIDvqqFtHX7fu7L0PSjBVsbRRDt9nD3KZjksJMqnazS9UJQ9RNv8XrP58+Ilorl24Vq 6Gq0+zGMuzv5IXH508Q11pTu9NqNXaqsSocM6oza8XoFr04h47OaAabhpO2SKxgJo6Oa dJvO2Mp0XBhQsSP3+30stj7souaRYGWKhWI9PU2AxkxFDte2O3IawtBsHdHO0ncvXRes 9U4lcqGEc6ZtZMoBfgQRp7CEdRAtejO/4g5rts5Sd683Lz37Y/Fe5hWh3sLWJDameA7K /dRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CWuCmnYZ3rYBFYFtDW9Yup7590WZruWaHGy3MOpsLM0=; b=J/dQuyHfbeMjrMHJ5maQ02Ux5U7YHYp0ir5nmPqzmWSChNoRi1Kwu9KKUQeIcwJkvA 5K8wJKUlu94dRwrQ2wC238IfxC+Cz28rtBn8y00o8Wujn9MRq517uxTaEzuvechyk9Pt TCScrpg0U58rVqy2iG9W1REUl6xPOcJMfcDiJim1ZGBbA9E449E6u377xJu4oMtZPjfw 2LHHR76w5sqlv/ntGt9he3vfP7zb5b/m7UBtEKDGK7Nbs2Tc5NktRI1Bwhvm8TBu6MkX 7KaSpU1DStE30EMx61GxTC3LcxaG4xUsHuBOB9v/cgRFzAy99t7FAOwcxOCmGMMV5Yk+ oevg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="q/kuG9HX"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p19si12262541edu.169.2020.11.02.23.55.05; Mon, 02 Nov 2020 23:55:28 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="q/kuG9HX"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725997AbgKCHxD (ORCPT + 99 others); Tue, 3 Nov 2020 02:53:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:33540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725968AbgKCHxD (ORCPT ); Tue, 3 Nov 2020 02:53:03 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0333822384; Tue, 3 Nov 2020 07:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604389982; bh=jBeI1ygIVS761aJfvPTmZQO2j6AowLY8HbQheRGPKH4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q/kuG9HX3HDi8eIRstpuhogWBJrsS0dSsm9WMzEUw0Kz4GKe0toWL2dAv2lADkT5m dubEJIG44fQxQLMCO4Dd51mouK6PaIWQ5VCr4yfxSJ2/EgaKcOgytIi4LXRhC8jv41 M4wnvs4BYPyxq24/8OYf7KKCYw4HXdFg6n/8fHvs= Date: Tue, 3 Nov 2020 08:53:55 +0100 From: Greg KH To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Alex Deucher , Deepak R Varma , David Airlie , LKML , Maling list - DRI developers , Melissa Wen , amd-gfx list , Daniel Vetter , Daniel Vetter , Alex Deucher Subject: Re: [PATCH] drm/amdgpu: do not initialise global variables to 0 or NULL Message-ID: <20201103075355.GA2505796@kroah.com> References: <20201102184147.GA42288@localhost> <20201103065324.GD75930@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 02, 2020 at 09:48:25PM +0100, Christian K?nig wrote: > Am 03.11.20 um 07:53 schrieb Greg KH: > > On Mon, Nov 02, 2020 at 09:06:21PM +0100, Christian K?nig wrote: > > > Am 02.11.20 um 20:43 schrieb Alex Deucher: > > > > On Mon, Nov 2, 2020 at 1:42 PM Deepak R Varma wrote: > > > > > Initializing global variable to 0 or NULL is not necessary and should > > > > > be avoided. Issue reported by checkpatch script as: > > > > > ERROR: do not initialise globals to 0 (or NULL). > > > > I agree that this is technically correct, but a lot of people don't > > > > seem to know that so we get a lot of comments about this code for the > > > > variables that are not explicitly set. Seems less confusing to > > > > initialize them even if it not necessary. I don't have a particularly > > > > strong opinion on it however. > > > Agree with Alex. > > > > > > Especially for the module parameters we should have a explicit init value > > > for documentation purposes, even when it is 0. > > Why is this one tiny driver somehow special compared to the entire rest > > of the kernel? (hint, it isn't...) > > And it certainly shouldn't :) > > > Please follow the normal coding style rules, there's no reason to ignore > > them unless you like to constantly reject patches like this that get > > sent to you. > > Yeah, that's a rather good point. > > Not a particular strong opinion on this either, but when something global is > set to 0 people usually do this to emphases that it is important that it is > zero. Again, no, that's not what we have been doing in the kernel for the past 20+ years. If you do not set it to anything, we all know it is important for it to be set to 0. Otherwise we would explicitly set it to something else. And if we don't care, then that too doesn't matter so we let it be 0 by not initializing it, it doesn't matter. I think this very change is what started the whole "kernel janitor" movement all those years ago, because it was easily proven that this simple change saved both time and memory. This shouldn't even be an argument we are having anymore... thanks, greg k-h