Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE
       [not found] <20261130225428.99361-1-irogers@google.com>
@ 2026-11-30 22:54 ` Ian Rogers
  2026-12-01  5:16   ` Jernej Škrabec
  2026-11-30 22:54 ` [PATCH 05/10] phy: google: usb: " Ian Rogers
  1 sibling, 1 reply; 3+ 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 related	[flat|nested] 3+ messages in thread

* [PATCH 05/10] phy: google: usb: Set .owner = THIS_MODULE
       [not found] <20261130225428.99361-1-irogers@google.com>
  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
  1 sibling, 0 replies; 3+ 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 related	[flat|nested] 3+ messages in thread

* Re: [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE
  2026-11-30 22:54 ` [PATCH 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE Ian Rogers
@ 2026-12-01  5:16   ` Jernej Škrabec
  0 siblings, 0 replies; 3+ messages in thread
From: Jernej Škrabec @ 2026-12-01  5:16 UTC (permalink / raw)
  To: Vinod Koul, Ian Rogers
  Cc: Neil Armstrong, Manivannan Sadhasivam, Nathan Chancellor,
	linux-phy, llvm, linux-kernel, Ian Rogers, Chen-Yu Tsai,
	Samuel Holland, Maxime Ripard, Paul Kocialkowski,
	linux-arm-kernel, linux-sunxi

Dne ponedeljek, 30. november 2026 ob 23:54:17 Srednjeevropski standardni čas je Ian Rogers napisal(a):
> 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>

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> ---
>  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 = {
> 






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

end of thread, other threads:[~2026-12-01  5:16 UTC | newest]

Thread overview: 3+ messages (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 01/10] phy: allwinner: phy-sun6i-mipi-dphy: Set .owner = THIS_MODULE Ian Rogers
2026-12-01  5:16   ` Jernej Škrabec
2026-11-30 22:54 ` [PATCH 05/10] phy: google: usb: " Ian Rogers

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