From: "Bjørn Mork" <bjorn@mork.no>
To: Oliver Neukum <oneukum@suse.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [RFC] usb: r8152: interface driver before device driver
Date: Thu, 04 Jan 2024 13:00:01 +0100 [thread overview]
Message-ID: <87frzd9um6.fsf@miraculix.mork.no> (raw)
In-Reply-To: <20240104103811.2318-1-oneukum@suse.com> (Oliver Neukum's message of "Thu, 4 Jan 2024 11:37:59 +0100")
Oliver Neukum <oneukum@suse.com> writes:
> The r8152 interface driver is preferred over the generic
> class driver because it provides more features. Hence
> we now have a device driver that switches the configuration.
>
> That device driver is sensible only if an interface driver
> for the selected configuration exists.
> However, the initialization for this module first reisters
> the device driver and after that the interface driver.
> That screws up error handling. Both registrations return
> error codes. That means that the registration of the
> device driver can currently work, but the interface
> driver can fail.
> In that case we switch the devices to a configuration
> we have no driver for. That must not happen. The easiest
> fix is to register the interface driver first and
> bail out if that fails. That way if the device driver
> fails, nothing needs to be undone.
Yup. Switching this around makes sense.
> + ret = usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE);
> + return ret;
> +
Why not
return usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE);
?
Bjørn
next prev parent reply other threads:[~2024-01-04 12:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 10:37 [RFC] usb: r8152: interface driver before device driver Oliver Neukum
2024-01-04 10:44 ` Greg KH
2024-01-04 12:00 ` Bjørn Mork [this message]
2024-01-04 12:18 ` Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frzd9um6.fsf@miraculix.mork.no \
--to=bjorn@mork.no \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox