From patchwork Fri May 21 20:04:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 12273675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A83CFC4707D for ; Fri, 21 May 2021 20:07:02 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3474161164 for ; Fri, 21 May 2021 20:07:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3474161164 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=BZ2e9eVkVwJRhFe7g+RHz/FQ7rIcVQ3P57o7o+nP+Lo=; b=QQ6ZtMkPkoYURsG8xDCR0ZDXee dtaxdK6WOOXymWGB8T2B99/0sEROkGwfKtcoRdMLZl7jvQqVdxJBjta7Q/wdAt8RFLJOqSlKASnIS 3swFZA+XMzjTfQ23CqUfYfO7yahK5+tHRxRjXsV1CewfzSF7nnqJ80g8vEJW2VFRhxImQKrXoFlOP d7kyeV14dz84DnYV6u7+QTDqBb4YsvLaRamUR0jpfe+vGh7/1X0vdwfTCNPzG72GatpM92pveOc9n j05+A8A4O6NunoJjUlD5CgSnsO9kwuXKa69KOR/Ol8oUUGPeaswT2sxBJUaqDHZj/TdOOSsrenmV7 ujH1WvHg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lkBOU-000y5g-8Y; Fri, 21 May 2021 20:05:14 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lkBOL-000y5J-EV for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 20:05:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Lzg66wuzASaMfTHwEiQwg/u8XktLpASuIJjQt1N/kuo=; b=Dt5/2hef1+xxxBkMa3XLjC/pz7 8HHTZV9u6wgWamzMDi9wwYiHjUFJUwbKhj/K+3y82o/dYF6odhpI3NA2pFxa3FM+x3az7ZwqU8Y1p vNrfH+N6w5QnamF2m2clukJj65eWsEs1IjiBx12tOopzURPwfExCfO8sBtVNOcI2ZLlONG0YUOTfI JdfUMV8Jit3Z6Roq3m3ykt2cz4whULnLOtBmoz5cNsHDudrdS4gjTJ0k2tGdH1pDkHuNvbxS7blPC 3kau16CyokiBPegY2shJ5XpTbYPOBDl4vwHJ/9m+WckyYsBsY/Gizt/EyBQLUoArdvPC9Wvpa67TV OfaLVABg==; Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lkBOI-00HOk8-MM for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 20:05:03 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id v13-20020a4aa40d0000b02902052145a469so4847095ool.3 for ; Fri, 21 May 2021 13:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lzg66wuzASaMfTHwEiQwg/u8XktLpASuIJjQt1N/kuo=; b=FU7oXsN5JQzdq5+zP80ciK7QmQ2OmK8b5yQw+iS0awapeC953l4vgk7lLliC5boEZ3 Ip3Qh0tGWljGWIvwxVCLUzPDvzSJqANt8vy0VRi7P4ocTh8EGgJcsaZtEoJgcAct8PAA DDQ99sBgV+90JPclFqmFF5Rj9mwu+EnEqsFrmwJlVmpIlyiqlycjVAoU9e0NEoa0evwA DMZkyZMTi2sOLYg4k3xd647o2GG7+UmRnEoA4y6TF63/LR8cdH4kB4JeOIDIAlr0jy+H zjeBTPITF8m29liEhvIxP0eMLxo+1yfFkLZGEnhQ/1e/otMHXjEjncETKapC+7UGqdWa Q93A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=Lzg66wuzASaMfTHwEiQwg/u8XktLpASuIJjQt1N/kuo=; b=IsXAooDsaybljmOr7sKhobtLpqD1j5vmCg0X95WxAPawSFF3WRwQkGT2mSzQkYXHOp oCPeOBPBPsn6vHOKUYwU+hGoNemhlIABuKf1gn6ayA2ZTvnAONK6COkJWaFTPY7s+Wi8 OacurxOoFxJamCMTVSrIySChYwP4naxoqMBX8Tzcya7U9Y//Svax9q0mGfIC8RZ4lVNz CrCmSxgUJzRqMDxSwkHLDEG0gDiuaWHIWeZaggnevGog0ikD8NqpVKDCZQg8hHZYniIA NofBlHcXg5V9bUb70tXJG9n4YwDQEo7nVB713ic+Yymbr96zFAKLTrMX7E+EYpi1NlV8 +Czw== X-Gm-Message-State: AOAM533pUp32mtR2JGNds7ew1MtZTR9eRWjW1mEYpaEEKBhO9F7xVwU8 9TC5OyyPIy/Ybz1/B/qvYhA= X-Google-Smtp-Source: ABdhPJxl9/Nm+6svLD2w6ZD46nm3ERoRNVnBbWJYVzq32/FZkh6HNexRG5Hi7Xgoz3ASHBFoZefBmg== X-Received: by 2002:a05:6820:54e:: with SMTP id n14mr9556416ooj.49.1621627500369; Fri, 21 May 2021 13:05:00 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d67sm1292501oia.56.2021.05.21.13.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 13:04:59 -0700 (PDT) From: Guenter Roeck To: Derek Kiernan Cc: Arnd Bergmann , Greg Kroah-Hartman , Michal Simek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Guenter Roeck , Dragan Cvetic Subject: [PATCH] misc: xilinx-sdfec: Drop unnecessary NULL check after container_of Date: Fri, 21 May 2021 13:04:57 -0700 Message-Id: <20210521200457.2112041-1-linux@roeck-us.net> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_130502_749151_18ECFF73 X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org container_of() only returns NULL if the passed pointer is NULL _and_ if the embedded element is the first element of the structure. Even if that is the case, testing against it is misleading and possibly dangerous because the position of the embedded element may change. In this case, the check is unnecessary since it is known that file->private_data is never NULL for an open file, and container_of() will therefore also never be NULL. Drop the check. Acked-by: Dragan Cvetic Signed-off-by: Guenter Roeck --- change since RFC: Dropped check for the result of container_of() result instead of checking if file->private_data is NULL. drivers/misc/xilinx_sdfec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c index 23c8448a9c3b..d6e3c650bd11 100644 --- a/drivers/misc/xilinx_sdfec.c +++ b/drivers/misc/xilinx_sdfec.c @@ -1013,9 +1013,6 @@ static __poll_t xsdfec_poll(struct file *file, poll_table *wait) xsdfec = container_of(file->private_data, struct xsdfec_dev, miscdev); - if (!xsdfec) - return EPOLLNVAL | EPOLLHUP; - poll_wait(file, &xsdfec->waitq, wait); /* XSDFEC ISR detected an error */