mbox series

[wifi-next,0/6] wifi: Convert to platform remove callback returning void

Message ID 20231117093056.873834-8-u.kleine-koenig@pengutronix.de
Headers show
Series wifi: Convert to platform remove callback returning void | expand

Message

Uwe Kleine-König Nov. 17, 2023, 9:30 a.m. UTC
Hello,

this series converts the platform drivers below drivers/net/wireless to
make use of .remove_new().

See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.
The TL;DR; is to make it harder for driver authors to leak resources
without noticing.

Best regards
Uwe

Uwe Kleine-König (6):
  wifi: ath11k: Convert to platform remove callback returning void
  wifi: ath5k: Convert to platform remove callback returning void
  wifi: ath9k: Convert to platform remove callback returning void
  wifi: wcn36xx: Convert to platform remove callback returning void
  wifi: brcmfmac: Convert to platform remove callback returning void
  wifi: mt76: Convert to platform remove callback returning void

 drivers/net/wireless/ath/ath11k/ahb.c                     | 6 ++----
 drivers/net/wireless/ath/ath5k/ahb.c                      | 8 +++-----
 drivers/net/wireless/ath/ath9k/ahb.c                      | 6 ++----
 drivers/net/wireless/ath/wcn36xx/main.c                   | 6 ++----
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 6 ++----
 drivers/net/wireless/mediatek/mt76/mt7603/soc.c           | 7 ++-----
 drivers/net/wireless/mediatek/mt76/mt7615/soc.c           | 6 ++----
 drivers/net/wireless/mediatek/mt76/mt7915/soc.c           | 6 ++----
 8 files changed, 17 insertions(+), 34 deletions(-)

base-commit: eff99d8edbed7918317331ebd1e365d8e955d65e

Comments

Jeff Johnson Nov. 17, 2023, 7:19 p.m. UTC | #1
On 11/17/2023 1:31 AM, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Jeff Johnson Nov. 17, 2023, 7:20 p.m. UTC | #2
On 11/17/2023 1:31 AM, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
not my driver but since it is trivial
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>