mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops
@ 2026-11-30 22:54 Ian Rogers
  2026-11-30 22:54 ` [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE Ian Rogers
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages 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

phy_get() and of_phy_get() call try_module_get(phy->ops->owner) to pin
the PHY provider module while a PHY is in use, and of_phy_put() calls
module_put(phy->ops->owner). Ten modular drivers under drivers/phy/ omit
.owner = THIS_MODULE in their const struct phy_ops definitions, leaving
phy->ops->owner NULL.

Split per driver to simplify per-vendor review and stable backporting.

Tooling note: Found using Clang's require_explicit_initialization
attribute; an AI coding assistant helped audit call sites, verify Fixes
commits, and draft the changelogs. All ten drivers were build-tested as
modules (-DMODULE) with LLVM=1.

Ian Rogers (10):
  phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE
  phy: cadence: cdns-dphy-rx: Set .owner = THIS_MODULE
  phy: cadence: cdns-dphy: Set .owner = THIS_MODULE
  phy: eyeq5-eth: Set .owner = THIS_MODULE
  phy: google: usb: Set .owner = THIS_MODULE
  phy: qcom: ipq4019-usb: Set .owner = THIS_MODULE
  phy: renesas: r8a779f0-ether-serdes: Set .owner = THIS_MODULE
  phy: starfive: jh7110-dphy-rx: Set .owner = THIS_MODULE
  phy: sunplus: usb2: Set .owner = THIS_MODULE
  phy: tegra: mphy: Set .owner = THIS_MODULE

 drivers/phy/allwinner/phy-sun6i-mipi-dphy.c | 1 +
 drivers/phy/cadence/cdns-dphy-rx.c          | 1 +
 drivers/phy/cadence/cdns-dphy.c             | 1 +
 drivers/phy/phy-eyeq5-eth.c                 | 1 +
 drivers/phy/phy-google-usb.c                | 2 ++
 drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 2 ++
 drivers/phy/renesas/r8a779f0-ether-serdes.c | 1 +
 drivers/phy/starfive/phy-jh7110-dphy-rx.c   | 1 +
 drivers/phy/sunplus/phy-sunplus-usb2.c      | 1 +
 drivers/phy/tegra/phy-tegra-mphy.c          | 2 ++
 10 files changed, 13 insertions(+)


base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 02/10] phy: cadence: cdns-dphy-rx: " Ian Rogers
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages 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, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Maxime Ripard, Paul Kocialkowski,
	linux-arm-kernel, linux-sunxi

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 sun6i_dphy_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: bb3b6fcb6849 ("sun6i: dsi: Convert to generic phy handling")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/allwinner/phy-sun6i-mipi-dphy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
index e5a9aa3f4aac..663b3d4d295b 100644
--- a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
+++ b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
@@ -535,6 +535,7 @@ static const struct phy_ops sun6i_dphy_ops = {
 	.power_off	= sun6i_dphy_power_off,
 	.init		= sun6i_dphy_init,
 	.exit		= sun6i_dphy_exit,
+	.owner		= THIS_MODULE,
 };
 
 static const struct regmap_config sun6i_dphy_regmap_config = {
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 02/10] phy: cadence: cdns-dphy-rx: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
  2026-11-30 22:54 ` [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 03/10] phy: cadence: cdns-dphy: " Ian Rogers
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages 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, Laurent Pinchart,
	Pratyush Yadav

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 cdns_dphy_rx_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 41d393aaead4 ("phy: cadence: Add Cadence D-PHY Rx driver")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/cadence/cdns-dphy-rx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/cdns-dphy-rx.c b/drivers/phy/cadence/cdns-dphy-rx.c
index d3f7e9513dd6..97dbbe789bb5 100644
--- a/drivers/phy/cadence/cdns-dphy-rx.c
+++ b/drivers/phy/cadence/cdns-dphy-rx.c
@@ -232,6 +232,7 @@ static const struct phy_ops cdns_dphy_rx_ops = {
 	.power_off = cdns_dphy_rx_power_off,
 	.configure = cdns_dphy_rx_configure,
 	.validate = cdns_dphy_rx_validate,
+	.owner = THIS_MODULE,
 };
 
 static int cdns_dphy_rx_probe(struct platform_device *pdev)
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 03/10] phy: cadence: cdns-dphy: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
  2026-11-30 22:54 ` [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE Ian Rogers
  2026-11-30 22:54 ` [PATCH 02/10] phy: cadence: cdns-dphy-rx: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 04/10] phy: eyeq5-eth: " Ian Rogers
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages 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, Maxime Ripard,
	Sakari Ailus, Kishon Vijay Abraham I

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 cdns_dphy_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 7a343c8bf4b5 ("phy: Add Cadence D-PHY support")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/cadence/cdns-dphy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/cdns-dphy.c b/drivers/phy/cadence/cdns-dphy.c
index 483e35c82a11..00167cefd476 100644
--- a/drivers/phy/cadence/cdns-dphy.c
+++ b/drivers/phy/cadence/cdns-dphy.c
@@ -463,6 +463,7 @@ static const struct phy_ops cdns_dphy_ops = {
 	.validate	= cdns_dphy_validate,
 	.power_on	= cdns_dphy_power_on,
 	.power_off	= cdns_dphy_power_off,
+	.owner		= THIS_MODULE,
 };
 
 static int cdns_dphy_probe(struct platform_device *pdev)
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 04/10] phy: eyeq5-eth: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
                   ` (2 preceding siblings ...)
  2026-11-30 22:54 ` [PATCH 03/10] phy: cadence: cdns-dphy: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 05/10] phy: google: usb: " Ian Rogers
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages 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, Vladimir Kondratiev,
	Benoît Monin, Gregory CLEMENT, Théo Lebrun,
	Vladimir Oltean, Luca Ceresoli, linux-mips

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 eq5_phy_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: b6e33443876d ("phy: Add driver for EyeQ5 Ethernet PHY wrapper")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/phy-eyeq5-eth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/phy-eyeq5-eth.c b/drivers/phy/phy-eyeq5-eth.c
index fae147268f5f..69c428a867c8 100644
--- a/drivers/phy/phy-eyeq5-eth.c
+++ b/drivers/phy/phy-eyeq5-eth.c
@@ -182,6 +182,7 @@ static const struct phy_ops eq5_phy_ops = {
 	.power_off	= eq5_phy_power_off,
 	.set_mode	= eq5_phy_set_mode,
 	.validate	= eq5_phy_validate,
+	.owner		= THIS_MODULE,
 };
 
 static struct phy *eq5_phy_xlate(struct device *dev,
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 05/10] phy: google: usb: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
                   ` (3 preceding siblings ...)
  2026-11-30 22:54 ` [PATCH 04/10] phy: eyeq5-eth: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 06/10] phy: qcom: ipq4019-usb: " Ian Rogers
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages 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, Peter Griffin,
	André Draszik, Tudor Ambarus, Roy Luo, Joy Chakraborty,
	Naveen Kumar, RD Babiera, Neill Kapron, linux-arm-kernel,
	linux-samsung-soc

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 google_usb2_phy_ops and google_usb3_phy_ops,
found with Clang's require_explicit_initialization attribute.

Fixes: cbce66669c82 ("phy: Add Google Tensor SoC USB PHY driver")
Fixes: 8c2b331e6327 ("phy: Add USB3 PHY support to Google Tensor SoC USB PHY driver")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/phy-google-usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/phy/phy-google-usb.c b/drivers/phy/phy-google-usb.c
index 2acdb2b0e534..b820b1e34ad9 100644
--- a/drivers/phy/phy-google-usb.c
+++ b/drivers/phy/phy-google-usb.c
@@ -348,6 +348,7 @@ static int google_usb2_phy_exit(struct phy *_phy)
 static const struct phy_ops google_usb2_phy_ops = {
 	.init		= google_usb2_phy_init,
 	.exit		= google_usb2_phy_exit,
+	.owner		= THIS_MODULE,
 };
 
 static int google_usb3_phy_init(struct phy *_phy)
@@ -470,6 +471,7 @@ static const struct phy_ops google_usb3_phy_ops = {
 	.init		= google_usb3_phy_init,
 	.exit		= google_usb3_phy_exit,
 	.power_on	= google_usb3_phy_power_on,
+	.owner		= THIS_MODULE,
 };
 
 static struct phy *google_usb_phy_xlate(struct device *dev,
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 06/10] phy: qcom: ipq4019-usb: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
                   ` (4 preceding siblings ...)
  2026-11-30 22:54 ` [PATCH 05/10] phy: google: usb: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 07/10] phy: renesas: r8a779f0-ether-serdes: " Ian Rogers
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages 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, Robert Marko,
	Luka Perkov, John Crispin, linux-arm-msm

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 ipq4019_usb_ss_phy_ops and
ipq4019_usb_hs_phy_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 3c9d8f6c03a2 ("phy: add driver for Qualcomm IPQ40xx USB PHY")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
index 13ccad70e77a..afb2b10030cf 100644
--- a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
@@ -50,6 +50,7 @@ static int ipq4019_ss_phy_power_on(struct phy *_phy)
 static const struct phy_ops ipq4019_usb_ss_phy_ops = {
 	.power_on	= ipq4019_ss_phy_power_on,
 	.power_off	= ipq4019_ss_phy_power_off,
+	.owner		= THIS_MODULE,
 };
 
 static int ipq4019_hs_phy_power_off(struct phy *_phy)
@@ -82,6 +83,7 @@ static int ipq4019_hs_phy_power_on(struct phy *_phy)
 static const struct phy_ops ipq4019_usb_hs_phy_ops = {
 	.power_on	= ipq4019_hs_phy_power_on,
 	.power_off	= ipq4019_hs_phy_power_off,
+	.owner		= THIS_MODULE,
 };
 
 static const struct of_device_id ipq4019_usb_phy_of_match[] = {
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 07/10] phy: renesas: r8a779f0-ether-serdes: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
                   ` (5 preceding siblings ...)
  2026-11-30 22:54 ` [PATCH 06/10] phy: qcom: ipq4019-usb: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 08/10] phy: starfive: jh7110-dphy-rx: " Ian Rogers
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages 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, Yoshihiro Shimoda

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 r8a779f0_eth_serdes_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 742859441d44 ("phy: renesas: Add Renesas Ethernet SERDES driver for R-Car S4-8")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/renesas/r8a779f0-ether-serdes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c
index 721d8ae527ca..c82e82fe7656 100644
--- a/drivers/phy/renesas/r8a779f0-ether-serdes.c
+++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c
@@ -404,6 +404,7 @@ static const struct phy_ops r8a779f0_eth_serdes_ops = {
 	.power_on	= r8a779f0_eth_serdes_power_on,
 	.set_mode	= r8a779f0_eth_serdes_set_mode,
 	.set_speed	= r8a779f0_eth_serdes_set_speed,
+	.owner		= THIS_MODULE,
 };
 
 static struct phy *r8a779f0_eth_serdes_xlate(struct device *dev,
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 08/10] phy: starfive: jh7110-dphy-rx: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
                   ` (6 preceding siblings ...)
  2026-11-30 22:54 ` [PATCH 07/10] phy: renesas: r8a779f0-ether-serdes: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 09/10] phy: sunplus: usb2: " Ian Rogers
  2026-11-30 22:54 ` [PATCH 10/10] phy: tegra: mphy: " Ian Rogers
  9 siblings, 0 replies; 11+ messages 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, Jack Zhu,
	Changhuang Liang, Minda Chen

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 stf_dphy_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: f8aa660841bc ("phy: starfive: Add mipi dphy rx support")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/starfive/phy-jh7110-dphy-rx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/starfive/phy-jh7110-dphy-rx.c b/drivers/phy/starfive/phy-jh7110-dphy-rx.c
index 043a7e11d187..895a9ff5ca0d 100644
--- a/drivers/phy/starfive/phy-jh7110-dphy-rx.c
+++ b/drivers/phy/starfive/phy-jh7110-dphy-rx.c
@@ -144,6 +144,7 @@ static const struct phy_ops stf_dphy_ops = {
 	.configure = stf_dphy_configure,
 	.power_on  = stf_dphy_power_on,
 	.power_off = stf_dphy_power_off,
+	.owner     = THIS_MODULE,
 };
 
 static int stf_dphy_probe(struct platform_device *pdev)
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 09/10] phy: sunplus: usb2: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
                   ` (7 preceding siblings ...)
  2026-11-30 22:54 ` [PATCH 08/10] phy: starfive: jh7110-dphy-rx: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  2026-11-30 22:54 ` [PATCH 10/10] phy: tegra: mphy: " Ian Rogers
  9 siblings, 0 replies; 11+ messages 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, Vincent Shih,
	linux-usb

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 sp_uphy_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/phy/sunplus/phy-sunplus-usb2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c
index 6fe096ff1e43..15c068ae48c1 100644
--- a/drivers/phy/sunplus/phy-sunplus-usb2.c
+++ b/drivers/phy/sunplus/phy-sunplus-usb2.c
@@ -227,6 +227,7 @@ static const struct phy_ops sp_uphy_ops = {
 	.power_on	= sp_uphy_power_on,
 	.power_off	= sp_uphy_power_off,
 	.exit		= sp_uphy_exit,
+	.owner		= THIS_MODULE,
 };
 
 static const struct of_device_id sp_uphy_dt_ids[] = {
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 10/10] phy: tegra: mphy: Set .owner = THIS_MODULE
  2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
                   ` (8 preceding siblings ...)
  2026-11-30 22:54 ` [PATCH 09/10] phy: sunplus: usb2: " Ian Rogers
@ 2026-11-30 22:54 ` Ian Rogers
  9 siblings, 0 replies; 11+ messages 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	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-11-30 22:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 22:54 [PATCH 00/10] phy: Set missing .owner = THIS_MODULE in phy_ops Ian Rogers
2026-11-30 22:54 ` [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE Ian Rogers
2026-11-30 22:54 ` [PATCH 02/10] phy: cadence: cdns-dphy-rx: " Ian Rogers
2026-11-30 22:54 ` [PATCH 03/10] phy: cadence: cdns-dphy: " Ian Rogers
2026-11-30 22:54 ` [PATCH 04/10] phy: eyeq5-eth: " Ian Rogers
2026-11-30 22:54 ` [PATCH 05/10] phy: google: usb: " Ian Rogers
2026-11-30 22:54 ` [PATCH 06/10] phy: qcom: ipq4019-usb: " Ian Rogers
2026-11-30 22:54 ` [PATCH 07/10] phy: renesas: r8a779f0-ether-serdes: " Ian Rogers
2026-11-30 22:54 ` [PATCH 08/10] phy: starfive: jh7110-dphy-rx: " Ian Rogers
2026-11-30 22:54 ` [PATCH 09/10] phy: sunplus: usb2: " Ian Rogers
2026-11-30 22:54 ` [PATCH 10/10] phy: tegra: mphy: " Ian Rogers

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

all inboxes | Powered by JetHome®