[PATCH 05/10] phy: google: usb: Set .owner = THIS_MODULE
Peter Griffin
peter.griffin at linaro.org
Wed Dec 2 03:32:33 PST 2026
On Mon, 30 Nov 2026 at 22:54, Ian Rogers <irogers at google.com> wrote:
>
> 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 at google.com>
> ---
Reviewed-by: Peter Griffin <peter.griffin at linaro.org>
> 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
>
More information about the linux-arm-kernel
mailing list