Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH 10/10] phy: tegra: mphy: Set .owner = THIS_MODULE
       [not found] <20261130225428.99361-1-irogers@google.com>
@ 2026-11-30 22:54 ` Ian Rogers
  0 siblings, 0 replies; only message in thread
From: Ian Rogers @ 2026-11-30 22:54 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Neil Armstrong, Manivannan Sadhasivam, Nathan Chancellor,
	linux-phy, llvm, linux-kernel, Ian Rogers, Thierry Reding,
	Jonathan Hunter, Kartik Rajput, linux-tegra

phy_get() and of_phy_get() call try_module_get(phy->ops->owner) to pin
the PHY provider module while the PHY is in use, and of_phy_put() calls
module_put(phy->ops->owner). Because phy->ops is const struct phy_ops *,
phy_create() cannot populate ops->owner at runtime, and
try_module_get(NULL) returns true without incrementing the module
reference count.

Set .owner = THIS_MODULE in tegra_mphy_rx_ops and tegra_mphy_tx_ops,
found with Clang's require_explicit_initialization attribute.

Fixes: 256cb243f4c2 ("phy: tegra: Add Tegra264 MPHY driver")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/tegra/phy-tegra-mphy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/phy/tegra/phy-tegra-mphy.c b/drivers/phy/tegra/phy-tegra-mphy.c
index 17722aaaa361..a054c102229a 100644
--- a/drivers/phy/tegra/phy-tegra-mphy.c
+++ b/drivers/phy/tegra/phy-tegra-mphy.c
@@ -276,6 +276,7 @@ static const struct phy_ops tegra_mphy_rx_ops = {
 	.power_off = tegra_mphy_rx_power_off,
 	.configure = tegra_mphy_rx_configure,
 	.calibrate = tegra_mphy_rx_calibrate,
+	.owner = THIS_MODULE,
 };
 
 static int tegra_mphy_tx_configure(struct phy *phy, union phy_configure_opts *opts)
@@ -339,6 +340,7 @@ static int tegra_mphy_tx_calibrate(struct phy *phy)
 static const struct phy_ops tegra_mphy_tx_ops = {
 	.configure = tegra_mphy_tx_configure,
 	.calibrate = tegra_mphy_tx_calibrate,
+	.owner = THIS_MODULE,
 };
 
 static struct phy *tegra_mphy_xlate(struct device *dev, const struct of_phandle_args *args)
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30 22:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261130225428.99361-1-irogers@google.com>
2026-11-30 22:54 ` [PATCH 10/10] phy: tegra: mphy: Set .owner = THIS_MODULE Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox