Re: [PATCH v1 4/9] can: Add Nuvoton NCT6694 CAN support

Marc Kleine-Budde
2024-10-24T10:03:40Z

[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]

Trimming Cc a bit

On 24.10.2024 16:59:17, Ming Yu wrote:
> +static struct platform_driver nct6694_canfd_driver = {
> + .driver = {
> + .name = DRVNAME,
> + },
> + .probe = nct6694_canfd_probe,
> + .remove = nct6694_canfd_remove,
> +};
> +
> +static int __init nct6694_init(void)
> +{
> + int err;
> +
> + err = platform_driver_register(&nct6694_canfd_driver);
> + if (!err) {
^^^^
> + if (err)
^^^

This look wrong.

> + platform_driver_unregister(&nct6694_canfd_driver);

Why do you want to unregister if registering fails?

> + }
> +
> + return err;
> +}
> +subsys_initcall(nct6694_init);
> +
> +static void __exit nct6694_exit(void)
> +{
> + platform_driver_unregister(&nct6694_canfd_driver);
> +}
> +module_exit(nct6694_exit);

Can you use

| module_platform_driver(nct6694_canfd_driver);

?

> +
> +MODULE_DESCRIPTION("USB-CAN FD driver for NCT6694");
> +MODULE_AUTHOR("Ming Yu <tmyu0@nuvoton.com>");
> +MODULE_LICENSE("GPL");
> --
> 2.34.1

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]