Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1925509pxy; Fri, 23 Apr 2021 23:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVyOG6vIIgc/vhbsChTCxWLxgSvpPSuzhSxrkRxdLLUpnK3Izmn2YDdOq4YN5oD48tOiom X-Received: by 2002:a05:6402:1492:: with SMTP id e18mr102990edv.225.1619244480965; Fri, 23 Apr 2021 23:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619244481; cv=none; d=google.com; s=arc-20160816; b=I2bOkdpyaLNKEhBnpS8LjADQ2RaHaIwO5wSJ/mAWc/0UYdZzFpRRRQPJbz//EVjXxe GlVXwDf+xidVCzjF2LAoW/75mtGZ400eIcfYjkB6xCgqHgPbLgVY2Gk8YjEY9HbO4+Wa Zm9iznvMMFBYKbsN+B9p8hzyn/fmvAVqj0dqk2DASE5vLqeu7kSVCtVQwchHqGg+M7VP RI2lCoWYwkf8baDIaBzlmjrJ+EkdpEozT6rJoSfCg739CZdaYJpV2Ij4Kv2gwD8zdPGF uyi9FUAaFAepsA8gxbsTAX+3IBwibs6FZ2TOaUFjbpJCEeBMCLBTaOzF3DVyMwqVDvLT 3K4A== 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=r3A2/ZighV5iFE0kXH4Q5rHf7EldsDVNTSn7mh+95KU=; b=yrXphGQWkWRweshjPitxPNfng1hAobjtS2vnC3f0DyBhArYdjXZErbu9qLIgwlIztL 9N8xD9hLZQfDZncJUJEViyr7ecnLZf2tJLiRTvzT7MqrecihdYTHkPH1f0n7RrFr009F Z2z5ocxkFyPnnk1gQKM3qsgmZUSa/eRDY+mlMvZm6/un3wrcquQ3LXMWAcbETBbwh5y/ z48PmFKI2LZT6tFUNoQgzDZ/f3IN2w4uwZfm1HzZ+ABBQIjBKzEjB3ms3fbsH68HPaah 5IQtTrGT+ePg0v4anlZUOT5lsPbiv0gZIGmVSuRMrbl3jmfk2/VI4U0AdE6chw8yH7iB Uq5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kzCUkt6g; 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=pass (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 k12si7543371ejq.726.2021.04.23.23.07.36; Fri, 23 Apr 2021 23:08:01 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kzCUkt6g; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231836AbhDXGCO (ORCPT + 99 others); Sat, 24 Apr 2021 02:02:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:40974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbhDXGCL (ORCPT ); Sat, 24 Apr 2021 02:02:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CA65361476; Sat, 24 Apr 2021 06:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619244093; bh=6XGCDXGcaoQ+hVBK/IbHul30nrRd138xcaNBNc7ZO9Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kzCUkt6gL4PZngkYY/CxCyfrXD08JEN5HSLIzrUpzRBkKDMU+iDBsZO096UcK+dzf oqFtfec72JDtWmI+QMomzhFE2Wb62/snFzN5IGKo0xBKzF2cEGLEopTP1EgqopDZW2 HJBzlDoCyXzxlHKeOIj/rkiUfmhRYzVZONsAtQbk= Date: Sat, 24 Apr 2021 08:01:28 +0200 From: Greg Kroah-Hartman To: Guenter Roeck Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Laurent Pinchart , Felipe Balbi Subject: Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of Message-ID: References: <20210423150626.138188-1-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210423150626.138188-1-linux@roeck-us.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 23, 2021 at 08:06:26AM -0700, Guenter Roeck wrote: > The parameters passed to allow_link and drop_link functions are never NULL. > That means the result of container_of() on those parameters is also > never NULL, even if the reference into the structure points to the first > element of the structure. Remove the subsequent NULL checks. > > The changes in this patch were made automatically using the following > Coccinelle script. > > @@ > type t; > identifier v; > statement s; > @@ > > <+... > ( > t v = container_of(...); > | > v = container_of(...); > ) > ... > when != v > - if (\( !v \| v == NULL \) ) s > ...+> > > Cc: Laurent Pinchart > Cc: Felipe Balbi > Cc: Greg Kroah-Hartman > Signed-off-by: Guenter Roeck > --- > After the recent discussion about a patch which tried to add a check > against NULL after container_of(), I realized that there are a number > of such checks in the kernel. > > Now the big question: Are patches like this acceptable, or do they count > as noise ? Yes they are acceptable, and no, they are not noise. I will be glad to take this after -rc1 is out, thanks. thanks, greg k-h