Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp592142imu; Thu, 13 Dec 2018 00:40:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vm9lEoP66Dw3eNXKufySg31FIwzuSaFlmAZwimdXDlGBybeIBesZqKZ4mLR41Mycv00fuw X-Received: by 2002:a62:c42:: with SMTP id u63mr22809857pfi.73.1544690453348; Thu, 13 Dec 2018 00:40:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544690453; cv=none; d=google.com; s=arc-20160816; b=0lbHy5ioWdhcqq1J4vCZqMpZ84vEG06jfMs3/Aef9AengVIDozYdeNQMpBCPGv7hGc DF/8LQSGlMgY84ob0pY28e093KETW/0/dvxa+Wcok/KtT1dUxI+eddHkFmfdMv/DOly1 S2QzgxqDKLTM+CEy6vpTaeDEpAtatDQ8PSG2TDf1tARLrV6oLArOkr/GN9QRwPMjc0MS BzR4TlYZ7b98BvA53E4cImdXHxHPxjHha+ZlGZdmu3Wgj/vg6XF2ijlOYfl8QoPSmVaY L/dFzVW6qHNbL2zY0Oqr6TUYJAGPFy18JJhllzZM0lbyLCWMkjM9p9yAn5wqCJUfBVDe dnHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wAyJsF8W43P5tsTOLjJtUBP5ihy05K/FWUbMvoiER38=; b=md7UESit9Jw39oHFrRIGUJdSzedAnaOiMUhaGB+jvc/AXLoZWwyRfb9q/NEyS1lEbP dGAGqgO0t4uRVQ8zYwdeTeATWuNSjiTi5jPraMvlawZ1ozlMRm3l5vCThinX0ghMJzbd B6bs2fCO15tY2mHPeiH9LvN5vZFOLwIfAGECvRJoKu919Y88mo53hRtGlp40gCQyRKT4 yEF6ZidobpCz+qP5D7AD7Nrqx7QNQZTFMtKsaRfU3bLnnslmeGOzL4sRXI9vCA5qsIgl V34lswwVDGWuXd1Di83u+6A9Eizt4uvDWlpsSbodXF3RnYoAZlTxcqhkOiGfzba9k2Cu N4Kg== ARC-Authentication-Results: i=1; mx.google.com; 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 p64si1118052pfg.79.2018.12.13.00.40.38; Thu, 13 Dec 2018 00:40:53 -0800 (PST) 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; 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 S1727528AbeLMIjS (ORCPT + 99 others); Thu, 13 Dec 2018 03:39:18 -0500 Received: from mail.bootlin.com ([62.4.15.54]:38638 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726945AbeLMIjO (ORCPT ); Thu, 13 Dec 2018 03:39:14 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id E68FB207E5; Thu, 13 Dec 2018 09:39:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost.localdomain (unknown [91.224.148.103]) by mail.bootlin.com (Postfix) with ESMTPSA id 099E0206FF; Thu, 13 Dec 2018 09:39:10 +0100 (CET) From: Miquel Raynal To: Gregory Clement , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Kishon Vijay Abraham I Cc: , , linux-kernel@vger.kernel.org, Rob Herring , Mark Rutland , Thomas Petazzoni , Antoine Tenart , Maxime Chevallier , Nadav Haklai , Marcin Wojtas , Grzegorz Jaszczyk , Miquel Raynal Subject: [PATCH v4 1/7] phy: mvebu-cp110-comphy: fix port check in ->xlate() Date: Thu, 13 Dec 2018 09:39:02 +0100 Message-Id: <20181213083908.14180-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181213083908.14180-1-miquel.raynal@bootlin.com> References: <20181213083908.14180-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So far the PHY ->xlate() callback was checking if the port was "invalid" before continuing, meaning that the port has not been used yet. This check is not correct as there is no opposite call to ->xlate() once the PHY is released by the user and the port will remain "valid" after the first phy_get()/phy_put() calls. Hence, if this driver is built as a module, inserted, removed and inserted again, the PHY will appear busy and the second probe will fail. To fix this, just drop the faulty check and instead verify that the port number is valid (ie. in the possible range). Signed-off-by: Miquel Raynal --- drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c index 187cccde53b5..d98e0451f6a1 100644 --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c @@ -580,8 +580,6 @@ static struct phy *mvebu_comphy_xlate(struct device *dev, return phy; lane = phy_get_drvdata(phy); - if (lane->port >= 0) - return ERR_PTR(-EBUSY); lane->port = args->args[0]; return phy; -- 2.19.1