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

Ming Yu
2024-11-01T01:27:15Z

Dear Marc,

Thank you for your comments,

> > +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);
>

I will modify platform driver registration to use module_platform_driver()
in the next patch.

Best regards
Ming