Message ID | 20240329-module-owner-sdio-v1-1-e4010b11ccaa@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | mmc/wifi/bluetooth: store owner from modules with sdio_register_driver() | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/SubjectPrefix | fail | "Bluetooth: " prefix is not specified in the subject |
tedd_an/BuildKernel | success | BuildKernel PASS |
tedd_an/CheckAllWarning | success | CheckAllWarning PASS |
tedd_an/CheckSparse | success | CheckSparse PASS |
tedd_an/CheckSmatch | fail | CheckSparse: FAIL: Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o' make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2 make[2]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o' make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2 |
tedd_an/BuildKernel32 | success | BuildKernel32 PASS |
tedd_an/TestRunnerSetup | success | TestRunnerSetup PASS |
tedd_an/TestRunner_l2cap-tester | success | TestRunner PASS |
tedd_an/TestRunner_iso-tester | success | TestRunner PASS |
tedd_an/TestRunner_bnep-tester | success | TestRunner PASS |
tedd_an/TestRunner_mgmt-tester | success | TestRunner PASS |
tedd_an/TestRunner_rfcomm-tester | success | TestRunner PASS |
tedd_an/TestRunner_sco-tester | success | TestRunner PASS |
tedd_an/TestRunner_ioctl-tester | success | TestRunner PASS |
tedd_an/TestRunner_mesh-tester | success | TestRunner PASS |
tedd_an/TestRunner_smp-tester | success | TestRunner PASS |
tedd_an/TestRunner_userchan-tester | success | TestRunner PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=839853 ---Test result--- Test Summary: CheckPatch PASS 4.61 seconds GitLint PASS 2.29 seconds SubjectPrefix FAIL 1.06 seconds BuildKernel PASS 29.05 seconds CheckAllWarning PASS 33.45 seconds CheckSparse PASS 38.27 seconds CheckSmatch FAIL 34.67 seconds BuildKernel32 PASS 28.48 seconds TestRunnerSetup PASS 514.63 seconds TestRunner_l2cap-tester PASS 17.94 seconds TestRunner_iso-tester PASS 29.71 seconds TestRunner_bnep-tester PASS 5.63 seconds TestRunner_mgmt-tester PASS 109.04 seconds TestRunner_rfcomm-tester PASS 7.30 seconds TestRunner_sco-tester PASS 14.92 seconds TestRunner_ioctl-tester PASS 7.76 seconds TestRunner_mesh-tester PASS 5.83 seconds TestRunner_smp-tester PASS 6.77 seconds TestRunner_userchan-tester PASS 4.96 seconds IncrementalBuild PASS 53.91 seconds Details ############################## Test: SubjectPrefix - FAIL Desc: Check subject contains "Bluetooth" prefix Output: "Bluetooth: " prefix is not specified in the subject "Bluetooth: " prefix is not specified in the subject "Bluetooth: " prefix is not specified in the subject "Bluetooth: " prefix is not specified in the subject "Bluetooth: " prefix is not specified in the subject "Bluetooth: " prefix is not specified in the subject "Bluetooth: " prefix is not specified in the subject ############################## Test: CheckSmatch - FAIL Desc: Run smatch tool with source Output: Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o' make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2 make[2]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o' make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2 --- Regards, Linux Bluetooth
Hello Krzysztof, On Fri, Mar 29, 2024 at 06:24:31PM +0100, Krzysztof Kozlowski wrote: > Modules registering driver with sdio_register_driver() might > forget to set .owner field. The field is used by some of other kernel ^^ double space here > parts for reference counting (try_module_get()), so it is expected that > drivers will set it. > > Solve the problem by moving this task away from the drivers to the core > code, just like we did for platform_driver in > commit 9447057eaff8 ("platform_device: use a macro instead of > platform_driver_register"). > > Since many drivers forget to set the .owner, this effectively will fix > them. Examples of fixed drivers are: ath6kl, b43, btsdio.c, ks7010, ^^ and here > libertas, MediaTek WiFi drivers, Realtek WiFi drivers, rsi, siano, > wilc1000, wl1251 and more. > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> My nit comments are irrelevant, but given you did the same twice I felt like letting you know. Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
On 31/03/2024 22:37, Francesco Dolcini wrote: > Hello Krzysztof, > > On Fri, Mar 29, 2024 at 06:24:31PM +0100, Krzysztof Kozlowski wrote: >> Modules registering driver with sdio_register_driver() might >> forget to set .owner field. The field is used by some of other kernel > ^^ double space here > >> parts for reference counting (try_module_get()), so it is expected that >> drivers will set it. >> >> Solve the problem by moving this task away from the drivers to the core >> code, just like we did for platform_driver in >> commit 9447057eaff8 ("platform_device: use a macro instead of >> platform_driver_register"). >> >> Since many drivers forget to set the .owner, this effectively will fix >> them. Examples of fixed drivers are: ath6kl, b43, btsdio.c, ks7010, > ^^ and here Which is correct :). Double space is on purpose. > >> libertas, MediaTek WiFi drivers, Realtek WiFi drivers, rsi, siano, >> wilc1000, wl1251 and more. >> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > My nit comments are irrelevant, but given you did the same twice I felt > like letting you know. > > Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com> > Best regards, Krzysztof
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 71d885fbc228..c5fdfe2325f8 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -265,16 +265,19 @@ void sdio_unregister_bus(void) } /** - * sdio_register_driver - register a function driver + * __sdio_register_driver - register a function driver * @drv: SDIO function driver + * @owner: owning module/driver */ -int sdio_register_driver(struct sdio_driver *drv) +int __sdio_register_driver(struct sdio_driver *drv, struct module *owner) { drv->drv.name = drv->name; drv->drv.bus = &sdio_bus_type; + drv->drv.owner = owner; + return driver_register(&drv->drv); } -EXPORT_SYMBOL_GPL(sdio_register_driver); +EXPORT_SYMBOL_GPL(__sdio_register_driver); /** * sdio_unregister_driver - unregister a function driver diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index 478855b8e406..fed1f5f4a8d3 100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h @@ -106,7 +106,10 @@ struct sdio_driver { .class = (dev_class), \ .vendor = SDIO_ANY_ID, .device = SDIO_ANY_ID -extern int sdio_register_driver(struct sdio_driver *); +/* use a macro to avoid include chaining to get THIS_MODULE */ +#define sdio_register_driver(drv) \ + __sdio_register_driver(drv, THIS_MODULE) +extern int __sdio_register_driver(struct sdio_driver *, struct module *); extern void sdio_unregister_driver(struct sdio_driver *); /**
Modules registering driver with sdio_register_driver() might forget to set .owner field. The field is used by some of other kernel parts for reference counting (try_module_get()), so it is expected that drivers will set it. Solve the problem by moving this task away from the drivers to the core code, just like we did for platform_driver in commit 9447057eaff8 ("platform_device: use a macro instead of platform_driver_register"). Since many drivers forget to set the .owner, this effectively will fix them. Examples of fixed drivers are: ath6kl, b43, btsdio.c, ks7010, libertas, MediaTek WiFi drivers, Realtek WiFi drivers, rsi, siano, wilc1000, wl1251 and more. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> --- drivers/mmc/core/sdio_bus.c | 9 ++++++--- include/linux/mmc/sdio_func.h | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-)