Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp580879rdb; Thu, 19 Oct 2023 12:42:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHknA2Gkn+Pw0AEcog0rBIjZkhPq4w94NvH3xQfcdnA2MD/gZwM9uO7W20FEWW13VQr+OQ6 X-Received: by 2002:a05:6870:f20e:b0:1d6:4b84:c7ed with SMTP id t14-20020a056870f20e00b001d64b84c7edmr3875017oao.23.1697744555643; Thu, 19 Oct 2023 12:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697744555; cv=none; d=google.com; s=arc-20160816; b=RnFaj2UmNuxlB4qx+c4gCjqa6Pfn68K2SO9kPjR10OTT5EVWzp6+Snp5U6u/LLkhvi 6QE2kyQ9L9xOnCqNax0WV217Mxmm/8omFVodJIPQaMKLw0DigtMFpL1+UT+WtPUqijCh YuoUXd+/HnDsphumj3N7482WTIRsmc8tGcZ7T/V/+ph5yliQB6m+NAfBNuG/kYGMospS 5HWvlujrMLezh4DV3rlGC43p2KbSn8OxdhMgouhDZ0XpVc6nOgxX6pHhyRxtqGnKOOTN Du4SsNJcfkWZndbmvuTkU3LOmRBoCiPFiAvWWoHXgVh4vklOOBDwhiMjRENhVzr6JEb8 m5Xg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=X1W/rWkbY0m8RVfsgwhoketonX/A09o6Hwc0XABja0w=; fh=Mkqd68rbVqYqMGREMkDZFpnJu8JA+iQ8yVnpR5knIGI=; b=lyboBbjc7Qzz3uCSFpyMIkw0D1u+1dHpK8/bj/y+kO5dgNikZz6obMQliJNYu3SaYU t098aIwFpAItM0Lku5RmZ6hh5NxMYWd1y7v4EeYBy2PPMo//mQRQGqoe0mK1Rpts9lRT Nbur10FHBwFXFzwIdzzRFfusBVK6Zx5uNZrGDgQiAG58mLMKyGJa+xhAxOayYtMJ3yLV cSVPPzlaRXae9sZH2kCqeYdtlc3VrMYTKXdmIQmZF1z9qxtcFRO80gEbwQwimecIc5BJ 4IT5aYh7LECTjSNheBTs0/5rhb+9FNS24Y/LJoogACkYB4cs5pFPmUsWqT4f6feLKf/p Rj6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kf7/OMEA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o25-20020a639a19000000b00588fa0def24si232742pge.777.2023.10.19.12.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 12:42:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kf7/OMEA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id ACC5B8274ADF; Thu, 19 Oct 2023 12:42:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346553AbjJSTmd (ORCPT + 99 others); Thu, 19 Oct 2023 15:42:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbjJSTmb (ORCPT ); Thu, 19 Oct 2023 15:42:31 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46AC9CA for ; Thu, 19 Oct 2023 12:42:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 630A0C433C7; Thu, 19 Oct 2023 19:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697744549; bh=IcYvNkduo8XEK3Ilcyifr1Kit0TXp2+8yl9djUAt/+k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kf7/OMEA7U8WtqYshNu2sZHSTr7BzhrPJPy7BRb3ZaLRlYcyZQtNNqGK4lA/KUxHv dHpW/xeJXjGSZDsru4+9+V6dadQyAYaSdwiGclvlRbP8KiNP/gTRXkD8KHZQDzWNFQ 6YyWvhvAPIkKzB/qVdXR6iHEgfvaS0EL30wkIftE= Date: Thu, 19 Oct 2023 21:42:26 +0200 From: Greg Kroah-Hartman To: Soumya Negi Cc: Martyn Welch , Manohar Vanga , outreachy@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH 1/2] staging: vme_user: Replace printk() with pr_*(),dev_*() Message-ID: <2023101941-poncho-disagree-8c77@gregkh> References: <2023101823-unhidden-draw-d68c@gregkh> <20231018193855.GA32553@Negi> <2023101925-kudos-playful-7c5a@gregkh> <20231019190618.GA29750@Negi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231019190618.GA29750@Negi> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 12:42:34 -0700 (PDT) On Thu, Oct 19, 2023 at 12:06:18PM -0700, Soumya Negi wrote: > On Thu, Oct 19, 2023 at 05:34:01PM +0200, Greg Kroah-Hartman wrote: > > On Wed, Oct 18, 2023 at 12:38:56PM -0700, Soumya Negi wrote: > > > Hi Greg, > > > > > > On Wed, Oct 18, 2023 at 03:26:07PM +0200, Greg Kroah-Hartman wrote: > > > > On Tue, Oct 17, 2023 at 09:36:32PM -0700, Soumya Negi wrote: > > > > > vme.c uses printk() to log messages. To improve and standardize message > > > > > formatting, use logging mechanisms pr_err()/pr_warn() and > > > > > dev_err()/dev_warn() instead. Retain the printk log levels of the > > > > > messages during replacement. > > > > > > > > > > Issue found by checkpatch.pl > > > > > > > > > > Signed-off-by: Soumya Negi > > > > > --- > > > > > drivers/staging/vme_user/vme.c | 175 ++++++++++++++++++--------------- > > > > > 1 file changed, 94 insertions(+), 81 deletions(-) > > > > > > > > > > diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c > > > > > index 6519a7c994a0..e8c2c1e77b7d 100644 > > > > > --- a/drivers/staging/vme_user/vme.c > > > > > +++ b/drivers/staging/vme_user/vme.c > > > > > @@ -9,6 +9,8 @@ > > > > > * Copyright 2004 Motorola Inc. > > > > > */ > > > > > > > > > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > > > > > > > No, this is a driver, as others have pointed out, always use dev_*() > > > > calls instead. > > > > > > Some of the pr_ fns can be dev_, but I don't think all can. > > > e.g. device NULL-check error messages > > > > I would argue that those are pointless and can be removed and also the > > check is probably not needed either. > > Got it. The pr_() in find_bridge() can't be converted to dev_ so I'll remove > the message entirely in another patch. > > I understand that the device-NULL checks should be done on the caller's side. > Since empty devices would mean something went wrong, would it be better to > put in an assertion(..WARN_ON) when removing the check? WARN_ON() means "I have no idea what can happen here so I give up", which is not a good idea in kernel development. If that every hits, then your machine will reboot as the huge majority of all Linux systems in the world run with panic-on-warn enabled. If it is impossible for something to happen (i.e. you control all callers) then just do not check for it. If it happens, you will get a NULL-dereference which is the same as a WARN_ON() in a way. No new WARN_ON() should ever be added to the kernel, especially in a driver. Handle the condition if it is possible to be hit. If it can never be hit, don't even check it. thanks, greg k-h