Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp2409120pxy; Sat, 24 Apr 2021 15:11:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ4As4qf+wT6zOdN7KQ9PuNudFLiKKlV6sXXv8RM5j1yWfgvs4qOYrspQbI2OQDd48HKnT X-Received: by 2002:a05:6402:510f:: with SMTP id m15mr12444806edd.328.1619302280517; Sat, 24 Apr 2021 15:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619302280; cv=none; d=google.com; s=arc-20160816; b=P1KKa0HuNrNTuIZG+o5BAxf+zqc5EEAqCrWUoO9JurpCYo7KrEZlX5v4d8ZrUi531Y ve4V2shrSpBjq9pcsnYQF2K9AVym/norpBQAgHHOxO0u3s/afp4E50dRU1oLzT5D7yDh n6EkOOSn7OBbd4dZzQvk3CGthEWMjpcFhsyOtqY0zbl3LDgod8fO9iUNNAq8fj7mizD1 SBnFMeS81aps0pDg1ZKQO8sCUWAKAOwurfXaJvkIdmTBUuuAH/umjPN1Q52ipDq695/T k9aV6Uol5WtuEqDoEbOQ69h1i4keXOzdUo6uhwOO8ByHEFSHDHoWU5HnLW7KaB1vJB4n 4mGg== 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=vv2R5KcbSnDnoBNEZu94o6gduwDoDVe49VFP9WxYq6Q=; b=ijJQ/ufvLaG+QnLyDEOO6V+a/YhuJIaPa9EgwObapnoZbTOjsC4txsSMojO1wA5mKX eqxhnzakioFjy6T1QMXm5ahtBM88c/5VX6fZMLGAUCkeXliYrq4bsmpagMlyFKdaiPA0 EQ92Lz4g4OcBBm7OVouLQKI/G6oalCT5u4rwCD27nBznsv6/xjrO7DilPXYguSjt8JSY rkQKPoBFNM7akB2sJxkHybj9xbXk9FJDs3ERHJESJGVcj4ZvlD2Xbaik5Bv+fg+W3+zh fzk9SsLHf2RPSa2Axgfxmkshe/2rkfS5HwIL+yfn0P2O106nGhCtyrOFhQYZpJZfV703 aEfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=dgCwT6PG; 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 a13si1868939edx.408.2021.04.24.15.10.43; Sat, 24 Apr 2021 15:11:20 -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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=dgCwT6PG; 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 S237277AbhDXWIo (ORCPT + 99 others); Sat, 24 Apr 2021 18:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbhDXWIn (ORCPT ); Sat, 24 Apr 2021 18:08:43 -0400 Received: from perceval.ideasonboard.com (unknown [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE75BC061574; Sat, 24 Apr 2021 15:08:04 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D393AE9; Sun, 25 Apr 2021 00:07:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1619302068; bh=BjhgVKeI9yTNn8YuXQucQOXP2zoxErBFMZNX8p4BcVw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dgCwT6PGpgwUDRAH3o8xjsKUmQ7KTiYh68Ib1KH5df6CZWixyPHqheTubBfnZ1MjL sANFoL5wjuxIjWe/0xyI+y1wAHLReQRTmRnpi6rqZUZrtUSGX6Mc37XxcPJX4+X/TC 2BRnMw7T20JH18tnj2vWKt8G/8uoOGACDeSsQm7w= Date: Sun, 25 Apr 2021 01:07:42 +0300 From: Laurent Pinchart To: Guenter Roeck Cc: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of Message-ID: References: <20210423150626.138188-1-linux@roeck-us.net> <87v98ckt2w.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87v98ckt2w.fsf@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Guenter, On Sat, Apr 24, 2021 at 11:03:19AM +0300, Felipe Balbi wrote: > Guenter Roeck writes: > > 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 ? > > Not noise in my book :-) > > Acked-by: Felipe Balbi Likewise, Reviewed-by: Laurent Pinchart And thank you for the patch. -- Regards, Laurent Pinchart