Skip to contentSkip to conversation

phy: apple: atc: remove stale kernel-doc for removed struct members

PATCH Superseded Rosen Penev 3 participants 3 messages Jun 8 – Sep 8

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: apple: atc: remove stale kernel-doc for removed struct members

The @sw and @mux members were removed from struct apple_atcphy but their kernel-doc entries remained, causing kernel-doc warnings.

Assisted-by opencode:big-pickle
---
 drivers/phy/apple/atc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/phy/apple/atc.c +0 -2
index 4156fabad742..f09305dd76d1 100644
@@ -585,8 +585,6 @@ struct atcphy_mode_configuration {
  * @phys.dp: DisplayPort PHY instance
  * @phy_provider: PHY provider instance
  * @rcdev: Reset controller device
- * @sw: Type-C switch instance
- * @mux: Type-C mux instance
  * @lock: Mutex for synchronizing register access across PHY, Type-C switch/mux and reset controller
  */
 struct apple_atcphy {
Signature · 1 line
2.54.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] The patch removes kernel-doc descriptions for @sw and @mux, falsely claiming the struct members were removed, which introduces new kernel-doc warnings.

Pre-existing issues:
- [High] Type-C switch and mux objects are leaked and cause Use-After-Free on driver unbind or probe error. --

commit 2c0f305efb460c36ad63bcaef90a04f555e5a65b
Author: Rosen Penev <[email protected]>

phy: apple: atc: remove stale kernel-doc for removed struct members

The @sw and @mux members were removed from struct apple_atcphy but their kernel-doc entries remained, causing kernel-doc warnings.

Quoted 2 lines

The @sw and @mux members were removed from struct apple_atcphy but their kernel-doc entries remained, causing kernel-doc warnings.

[Severity: Low]
Are these members actually removed? The struct definition still contains both sw and mux. Removing their kernel-doc comments while the members remain will introduce new warnings about missing descriptions rather than fixing them.

drivers/phy/apple/atc.c struct atcphy_mode_configuration { · line 590

Quoted 13 lines
drivers/phy/apple/atc.c +0 -2
index e9d106f135c51..37be29d855cd9 100644
@@ -585,8 +585,6 @@ struct atcphy_mode_configuration {
  * @phys.dp: DisplayPort PHY instance
  * @phy_provider: PHY provider instance
  * @rcdev: Reset controller device
- * @sw: Type-C switch instance
- * @mux: Type-C mux instance
  * @lock: Mutex for synchronizing register access across PHY, Type-C switch/mux and reset controller
  */
 struct apple_atcphy {

[Severity: High]
This is a pre-existing issue, but do we leak the Type-C switch and mux objects on probe error or driver unbind?

Looking at atcphy_probe_switch() and atcphy_probe_mux(), they register the devices but discard the pointers:

	return PTR_ERR_OR_ZERO(typec_switch_register(atcphy->dev, &sw_desc));

Since these aren't devres-managed, the pointers must be saved to properly call typec_switch_unregister() and typec_mux_unregister() on teardown.

If the driver is unbound or probe fails later, the devres-managed atcphy context is freed. The registered switch and mux still retain a pointer to this freed memory in their drvdata. Later calls like atcphy_mux_set() will dereference it:

	struct apple_atcphy *atcphy = typec_mux_get_drvdata(mux);

	guard(mutex)(&atcphy->lock);

Could this result in a use-after-free?

Signature · 6 lines
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Rosen Penev
Quoted 2 lines · Rosen Penev

The @sw and @mux members were removed from struct apple_atcphy but their kernel-doc entries remained, causing kernel-doc warnings.

These members were never present. So 'removed' is misleading.

Quoted 2 lines
Assisted-by opencode:big-pickle

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்