Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2414633ybm; Thu, 23 May 2019 17:01:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPW8xw0SoH+eZF2Nj07uLuJ7RXKHoD2i9xCc9ziNpwkBHTvlhyi6JNWEQ5M6HBvX3BJWQB X-Received: by 2002:a17:90a:2ec3:: with SMTP id h3mr5288445pjs.101.1558656068665; Thu, 23 May 2019 17:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558656068; cv=none; d=google.com; s=arc-20160816; b=XvQ16GLzZGCwlEx0thiCppPAJXE5Y5UjRVzasUVLcZ4RFa/3EcoVMD45ETnEg2Z5eA X8wOqMr1uIVeN743YDTrNAaaeu4z3j5hUHsNRkAH0V5LaJARfig8RMZXt3HrwlNiLnvm FUtORUQgQYbe97RXDES9O9rbi8zevqRv+udTwCo1qCP2jB1CXUbH0wOvTCCnx8iWqOnX crv4hkETrSIXKwsy7y6qcOOwLIV6gBKDkiUfDca5xU9lAme2rAONtjlCYYLx/k/zfRbz FSD2vg6BUJwtcXWukeUEgZpaIqFhE22MtqWAEtMNnvPMPS+INeZAYEx/gWhbJ2Ra4AvM X6ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XOaG+GEFquIWc8ZqL+TFm0HU4q3YYIEJg9ZNEaLldJA=; b=nB3dO5YOwgIYYD+P/40tANq9CvoLkx0JZ0Ww5CivxMp5Rw9KwsY8rhB02kGdwt7TLN xbZm/Q8amKD4RKLuPe2DtNXldmrp40vyqmDnrIF76xK1KOyYi5310uObIo/LxiWw2/N9 wZpPtwCU5SA99mr4I5tHMTEI+k65IPalQwNp0wRZYi2AJM8b+ov6T1CIRN7yIMee2Y3U f3rt47WjmldRgx2Cem1GdLzxV6sv8uen0G0JYg1H19oqzSF1ZDReH6uxbUBwZXi2ys+A vz79VPq+H3HvIF5Gb0dHV1H338Kmn74mae1np8QzT6NwRsyTmu3dYZCcJnVSlZY6LiE5 zDCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="e+/gloxc"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13si1444737pjb.34.2019.05.23.17.00.47; Thu, 23 May 2019 17:01:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="e+/gloxc"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388629AbfEWX6F (ORCPT + 99 others); Thu, 23 May 2019 19:58:05 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:45267 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388232AbfEWX6F (ORCPT ); Thu, 23 May 2019 19:58:05 -0400 Received: by mail-lj1-f194.google.com with SMTP id r76so1591328lja.12 for ; Thu, 23 May 2019 16:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=XOaG+GEFquIWc8ZqL+TFm0HU4q3YYIEJg9ZNEaLldJA=; b=e+/gloxcunIS64ypJ+CKWxOR6GHBOe89ee8OezcPnTixwXbrsj4kCp/H/qB/aRRzIh QByPd96mLzxgV0ur/42UdEdAgLZta9m8/n8uZwMOjeSb+TCAnc5IAjCkYySrExJSMb2d 5Z95YKknKuZcNyY2ZBYmfV86byhj48xIMZADt3C/Bsyc5/tMvZzKhPLYGPDo19Yqvmjv Fud3GSHNHsFt1hu/P7rIEGw5vTXg2484c7fMGi49h6KWxersG0QgNTO1cpjLK/UmrfDl qsm3ycA+ZCK/MN4Cc9W533cBQNXDsSoSEJKuP2E1y+UuI6XDwek9p6GetycEEkiOPmfm YvEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=XOaG+GEFquIWc8ZqL+TFm0HU4q3YYIEJg9ZNEaLldJA=; b=ow+atmzn+amflvzLhENbi7Y20yFAEIxr/NAi9572+aPpMc7FbMQHY6c6faLMzdJqP2 2SoWAONsSUG71Ep+fwPAPeXqQgAMgScEGOKIH1J9NsccXzWfxpQRWb9jSgl2OyS7MZfA 9Hac9docNZGblBpMiHye3tGUmL58R4bLAXhMyCsg/WoUudiOiPXXrpiMjlrrk+vR3DTm Qa6ZqQwBYVqvy0GBJkTPh8W7S51V2r1oy21NPyakbqQ+4VDAAqJPHJRGbGHEbZ9L/IQc vRxfvyzA2EeUbbpWzu9oYGFV9mLdyM3Y8Gjv6Y8IOwzkGlSeFa8z5dJpUBUlbOZvUZdg 0hbA== X-Gm-Message-State: APjAAAXtescqX8OPbjd359R5MfoDQZuyAz+cdlDP9c67bjYHhD+11csH u0oo/vISkS2C3amx+e2X4vtIJyGuJ0afEu42gAG3Ug== X-Received: by 2002:a2e:874b:: with SMTP id q11mr22243701ljj.48.1558655883455; Thu, 23 May 2019 16:58:03 -0700 (PDT) MIME-Version: 1.0 References: <1558647944-13816-1-git-send-email-alan.mikhak@sifive.com> In-Reply-To: <1558647944-13816-1-git-send-email-alan.mikhak@sifive.com> From: Alan Mikhak Date: Thu, 23 May 2019 16:57:52 -0700 Message-ID: Subject: Re: [PATCH v2] PCI: endpoint: Set endpoint controller pointer to null To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kishon@ti.com, lorenzo.pieralisi@arm.com, linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Bjorn Helgaas Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Bjorn Helgaas On Thu, May 23, 2019 at 2:46 PM Alan Mikhak wrote: > > Set endpoint controller pointer to null in pci_epc_remove_epf() > to avoid -EBUSY on subsequent call to pci_epc_add_epf(). > > Requires checking for null endpoint function pointer. > > Signed-off-by: Alan Mikhak > --- > drivers/pci/endpoint/pci-epc-core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c > index e4712a0f249c..2091508c1620 100644 > --- a/drivers/pci/endpoint/pci-epc-core.c > +++ b/drivers/pci/endpoint/pci-epc-core.c > @@ -519,11 +519,12 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf) > { > unsigned long flags; > > - if (!epc || IS_ERR(epc)) > + if (!epc || IS_ERR(epc) || !epf) > return; > > spin_lock_irqsave(&epc->lock, flags); > list_del(&epf->list); > + epf->epc = NULL; > spin_unlock_irqrestore(&epc->lock, flags); > } > EXPORT_SYMBOL_GPL(pci_epc_remove_epf); > -- > 2.7.4 >