Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1979334pxy; Sat, 24 Apr 2021 01:11:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfd5mhPERggHflKVbJNGafWqFwKqEaG20jr+WbHeaDCpmaYjeLC0ibGA91pEK14zPq6iop X-Received: by 2002:a17:906:ad9a:: with SMTP id la26mr8173802ejb.190.1619251914100; Sat, 24 Apr 2021 01:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619251914; cv=none; d=google.com; s=arc-20160816; b=ABPdRDXsyE9RJDslmitu9Y3vC634aghCB3rvrLrnK5e5JsxE9tKPsaJDxwUYbZw2Q/ A0n7sNjMgh5/ZXQm3GXQmlc1JFow+Vg5SUOy4vvRPSO6PGtmzz8rGIun9bV0hfRqhWj+ GFc0Yz8XwBgOR2+qOj/b4+GyQljGJklDkRBenZl0kSKt3l4RjITp9z8roOgaLffBx3FF fROyoepV55wbFsW4eEZ6VV3pDaD3fQMP9NZT5+ktaHPPxrhX3+FX7EkdB4s1wJQcSe+0 mvysseEgj4FqT3zDSc/V66oFhZ6KB3wyQG4N5g31gffcVEr2xuPKD5982NZ934LfxegT 5CoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=oD1JWY/ypAyFw9GFWi0VUhk0elvwsIC3uYhs9mUp0jc=; b=tFRUjiE2Gh6QJ2YHFXAFOctaMVBJZztCPQwOBx9Yg0LwuFVLUDZGwU2Xv7/NxXM6Sx mS9EYjk7VZySvvMQsZi9M61E3wf+MQFEYXcw0ZMvPupDte95FfS77JNV2Zu41ha13Hi2 QxJs73lJfqyrVJEHzq9IbvIpOhwPpmSj0+DxR41c+JTphz9hHTWkTzO9V/gYcK0Ie60W o5hJKDWhnU0L9+CLZggxZT3R47VOfcP7+TWjghMqCPI7sncNBmJ5OfAvetFR1KPlRRao W3UJVQC9DkM45oSD622jNzUe8uMBlJinCqezf+RgV9yREgOnGrzcm+Cyd4JpX4WTaqNW YxkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OBnFQfIh; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si91059edz.389.2021.04.24.01.11.08; Sat, 24 Apr 2021 01:11:54 -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=@kernel.org header.s=k20201202 header.b=OBnFQfIh; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbhDXIEq (ORCPT + 99 others); Sat, 24 Apr 2021 04:04:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:48358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbhDXIEE (ORCPT ); Sat, 24 Apr 2021 04:04:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6CBBA61476; Sat, 24 Apr 2021 08:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619251406; bh=ACi0xfztTvH++jH+Sgr+d8QkUSznqRyTg1Zs4Bk80Fk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=OBnFQfIhClQawJYzIr6EVCR+DS6WGZN4AbZl2o4PbOsOqLIdQAhZ/6TL+kJWQ/XCm p5k7l75JVShk1xItZv3dNxSzdxUNzeNvNdhmFvtaH5D2Bm0lKIhdvavuCTCrotCiEQ AREFZdGRskLbcvUPZntzQf8ZhncHGMlxs7oxdPtdujtWqW7Jibzzw73yfFfQVmzwoz GxOV2wzuQyHIdIPRrxo9YERintgvpbFi29rF27dCmrjLmx/Liew9JR4XGB/aFWh/PJ Eh5rLy1ZwoQB6mtnBbsrruUOSbnR/GQIgx4YthU8t9Q44abWDOf2K0EgTD0dbeSVBd vZoX2WeOfqHbg== From: Felipe Balbi To: Guenter Roeck , linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Guenter Roeck , Laurent Pinchart , Greg Kroah-Hartman Subject: Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of In-Reply-To: <20210423150626.138188-1-linux@roeck-us.net> References: <20210423150626.138188-1-linux@roeck-us.net> Date: Sat, 24 Apr 2021 11:03:19 +0300 Message-ID: <87v98ckt2w.fsf@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Guenter, Guenter Roeck writes: > The parameters passed to allow_link and drop_link functions are never NUL= L. > 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 =3D container_of(...); > | > v =3D container_of(...); > ) > ... > when !=3D v > - if (\( !v \| v =3D=3D 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 ? Not noise in my book :-) Acked-by: Felipe Balbi =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJFBAEBCAAvFiEElLzh7wn96CXwjh2IzL64meEamQYFAmCD0McRHGJhbGJpQGtl cm5lbC5vcmcACgkQzL64meEamQbrFhAAjK7QrZdqVxK2EgTc5xcbtApDiUCVH3Cp 0SmpmqjFrREa0zV8cIbCtAW1ARmlOMCvo3BJ/vJseF/QlD74oB5Pw2VgldBEuMzP otOni5XlD6Jx2xq0F0HsZE4XNZL7QxRvjfQrhZjIdMZqAbuYlDC447vBAeX7ysBD jXiclZFO0rb9UcXaQVdW/6wGghKVdCwqCXkl1vgxsYR5cL6ifAOzfGE9Nvhb5Q6f o7Rm40i8vyal5LCer+SsR7EbAysbl0hd2cWdj2Y8vT4z9fLXc3zGFlrMxlgfKuYR FnBmzlUkIMAbMGOnkGf/8cC88IW1ehYpUhw4s8JsZD6HrFlnL/3OOUpTNlsq+8pe 8FeqNCLYHqEykxYW3EFkt4VHt3vpWAaiumZzJL7sqQ3WV2Ac4bMNwkgbQw+uJVjS CZxTf0CMTCT2pSi4MsS+FXd986ksgaJ6s6IbUeQzQ1uMbiWHGTIvWCqS1z0QCrg/ djoVPITcUtkifyNKkScnnVEygu3UjyzZmwzJwtwbW4+1qC5ttXRUvmkd++9ZhE7e nswhJQt20YkIsJU9+TgXoQHZHacNrAZXzbHjQcjdApl6oB22tXtbFzoy6PIy/HzU 1AND1nxp5J0rDxqIvAa3hhZSyUcT4H+KOt9sgpKlxPd3OTGXqiWb2QKJTgUtUYmN BpcEdOxCWog= =xIff -----END PGP SIGNATURE----- --=-=-=--