Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3558764pxj; Tue, 15 Jun 2021 03:43:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEEDqVYF2rxeFYUAD3mCi5iQYLtsxDhaMNJlvFHeDgzuurjbTDum230P9SdI9qxmtQE9Ix X-Received: by 2002:a6b:e50c:: with SMTP id y12mr18417719ioc.20.1623753819522; Tue, 15 Jun 2021 03:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623753819; cv=none; d=google.com; s=arc-20160816; b=lxk+WD1D6dTmcZhnkVmE4cK5FQ9tApL59SprWoA9jCJ4+nRQcy9znF4n/qyT6TDJgj yj9ZARMSEjS9c5bZDQgCITuC1kH47DvuCG+QmgO5gYiP8ptH1bBUYKPM5v+bchg+9nRs OlBT4z0HQTEGU8L6d62wWh4NCpcTeyZrXtnNCxx3Ony8jC0lfnCulmiKq2kzItOaCp0l W5Vbt7Efw6N/I1cTf4UxlXBVDhjkJBUxpk1Ap84zi+bdoAllU5T8u3CrO7apuby/4CTD uBNEK6dTh+/gzfW0wCyhztqUtnU9nfuw0x60TFouuQbYrQKeVNxVURLXu2TukzBG2BK1 8oQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dmarc-filter:sender:dkim-signature; bh=26jUmp4vDfJYFJ+Qjl7Y8g8Lair1pch9T7baqcUuAJ4=; b=nHqJJnLnZkRk5d1yKv5csCHI2i4Hp8yZw+RTUEASB0hWf6KRd8wc4UbxlwgfuhazxU PWbb1M+LtjaiMEEfpTVeM8jPCjX9eYRLI/zxwn6x6RX6X/gmAfoeKTqs23502yYne9/n czxXGYsZmdR2W55aKS+FAZpdZN3dYtx4yByUNWQs65rGT3mYnL2iF+VGSIoCjU8u2EmA e0JzZkcW+9LLOJHUH48cOn32QfZEPQnh4TzCT+ylV83CA14X1dDGbnNr8le0GwdeYR6K OFwjzxa9JcX7RTlGGeVCxjTW/sc767eOm0EpjlMlLtnV5XPaNIeIYPNRBNgJi+nXWLPA FfbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=iy9nhDJl; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 g23si18123653ioh.72.2021.06.15.03.43.27; Tue, 15 Jun 2021 03:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@mg.codeaurora.org header.s=smtp header.b=iy9nhDJl; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231546AbhFOKpO (ORCPT + 99 others); Tue, 15 Jun 2021 06:45:14 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:48812 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbhFOKpO (ORCPT ); Tue, 15 Jun 2021 06:45:14 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623753790; h=Date: Message-Id: Cc: To: References: In-Reply-To: From: Subject: Content-Transfer-Encoding: MIME-Version: Content-Type: Sender; bh=26jUmp4vDfJYFJ+Qjl7Y8g8Lair1pch9T7baqcUuAJ4=; b=iy9nhDJlsRa7DoCmoOmFz6ryRW19FPID4WtOzpxbvzTLQcZXRQL9AU8wQ+Im7n9nEUgk0eeG wnrCznXgTmKW1lr9T1vvBeT0O1u+oHMbegEmfiuXRlBjfik1OGPyaCM2OwHod4XngzYNyBJb /X7bB+KFmbudCx/YvXnMohlGJD0= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-west-2.postgun.com with SMTP id 60c88420b6ccaab753a548fc (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 15 Jun 2021 10:42:40 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 57EF3C433F1; Tue, 15 Jun 2021 10:42:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,BAYES_00, MISSING_DATE,MISSING_MID,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from tykki.adurom.net (tynnyri.adurom.net [51.15.11.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id CC250C433F1; Tue, 15 Jun 2021 10:42:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CC250C433F1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=kvalo@codeaurora.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: brcmsmac: Drop unnecessary NULL check after container_of From: Kalle Valo In-Reply-To: <20210511235629.1686038-1-linux@roeck-us.net> References: <20210511235629.1686038-1-linux@roeck-us.net> To: Guenter Roeck Cc: Arend van Spriel , "David S . Miller" , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck User-Agent: pwcli/0.1.0-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-Id: <20210615104240.57EF3C433F1@smtp.codeaurora.org> Date: Tue, 15 Jun 2021 10:42:40 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Guenter Roeck wrote: > The parameter passed to ai_detach() is guaranteed to never be NULL > because it is checked by the caller. Consequently, the result of > container_of() on it is also never NULL, and a NULL check on it > is unnecessary. Even without that, the NULL check would still be > unnecessary because the subsequent kfree() can handle NULL arguments. > On top of all that, it is misleading to check the result of container_of() > against NULL because the position of the contained element could change, > which would make the check invalid. Remove it. > > This change was made automatically with the following Coccinelle script. > > @@ > type t; > identifier v; > statement s; > @@ > > <+... > ( > t v = container_of(...); > | > v = container_of(...); > ) > ... > when != v > - if (\( !v \| v == NULL \) ) s > ...+> > > Signed-off-by: Guenter Roeck Patch applied to wireless-drivers-next.git, thanks. 34fe7038a3b3 brcmsmac: Drop unnecessary NULL check after container_of -- https://patchwork.kernel.org/project/linux-wireless/patch/20210511235629.1686038-1-linux@roeck-us.net/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches