From patchwork Wed Oct 17 16:05:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10645821 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB6E1109C for ; Wed, 17 Oct 2018 16:05:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC8FB286C5 for ; Wed, 17 Oct 2018 16:05:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAB98286D0; Wed, 17 Oct 2018 16:05:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D79D2286C5 for ; Wed, 17 Oct 2018 16:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727493AbeJRABl (ORCPT ); Wed, 17 Oct 2018 20:01:41 -0400 Received: from ale.deltatee.com ([207.54.116.67]:43164 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727048AbeJRABl (ORCPT ); Wed, 17 Oct 2018 20:01:41 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCoJu-0002Bv-VC; Wed, 17 Oct 2018 10:05:15 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gCoJt-0004fq-Rb; Wed, 17 Oct 2018 10:05:13 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: Dan Carpenter , Logan Gunthorpe , Bjorn Helgaas , Christoph Hellwig Date: Wed, 17 Oct 2018 10:05:10 -0600 Message-Id: <20181017160510.17926-1-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, dan.carpenter@oracle.com, logang@deltatee.com, bhelgaas@google.com, hch@infradead.org X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH] PCI/P2PDMA: Fix NULL check in pci_p2pmem_publish() X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We should only assign 'p2pmem_published' if 'pdev->p2pdma' is not NULL. The extra check on 'publish' makes no sense. Signed-off-by: Logan Gunthorpe Reported-by: Dan Carpenter Cc: Bjorn Helgaas Cc: Christoph Hellwig --- drivers/pci/p2pdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index da66c7e31730..d710b5ef65a1 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -678,10 +678,8 @@ EXPORT_SYMBOL_GPL(pci_p2pmem_free_sgl); */ void pci_p2pmem_publish(struct pci_dev *pdev, bool publish) { - if (publish && !pdev->p2pdma) - return; - - pdev->p2pdma->p2pmem_published = publish; + if (pdev->p2pdma) + pdev->p2pdma->p2pmem_published = publish; } EXPORT_SYMBOL_GPL(pci_p2pmem_publish);