OpenCloudOS-Kernel/drivers/usb
Dan Carpenter 58e4a2d27d extcon: Fix extcon_get_extcon_dev() error handling
The extcon_get_extcon_dev() function returns error pointers on error,
NULL when it's a -EPROBE_DEFER defer situation, and ERR_PTR(-ENODEV)
when the CONFIG_EXTCON option is disabled.  This is very complicated for
the callers to handle and a number of them had bugs that would lead to
an Oops.

In real life, there are two things which prevented crashes.  First,
error pointers would only be returned if there was bug in the caller
where they passed a NULL "extcon_name" and none of them do that.
Second, only two out of the eight drivers will build when CONFIG_EXTCON
is disabled.

The normal way to write this would be to return -EPROBE_DEFER directly
when appropriate and return NULL when CONFIG_EXTCON is disabled.  Then
the error handling is simple and just looks like:

	dev->edev = extcon_get_extcon_dev(acpi_dev_name(adev));
	if (IS_ERR(dev->edev))
		return PTR_ERR(dev->edev);

For the two drivers which can build with CONFIG_EXTCON disabled, then
extcon_get_extcon_dev() will now return NULL which is not treated as an
error and the probe will continue successfully.  Those two drivers are
"typec_fusb302" and "max8997-battery".  In the original code, the
typec_fusb302 driver had an 800ms hang in tcpm_get_current_limit() but
now that function is a no-op.  For the max8997-battery driver everything
should continue working as is.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2022-05-13 17:03:40 +09:00
..
atm exit: Rename complete_and_exit to kthread_complete_and_exit 2021-12-13 12:04:45 -06:00
c67x00 usb/c67x00: Replace tasklet with work 2021-01-26 18:36:37 +01:00
cdns3 usb: cdns3: Fix issue for clear halt endpoint 2022-04-09 17:18:00 +02:00
chipidea usb: udc: Fix typo in comment 2022-01-31 14:24:39 +01:00
class usb: usbtmc: Fix bug in pipe direction for control transfers 2022-03-15 18:45:31 +01:00
common usb: common: usb-conn-gpio: Make VBUS supply completely optional 2022-03-15 18:22:15 +01:00
core usb: core: Don't hold the device lock while sleeping in do_proc_control() 2022-04-21 19:17:00 +02:00
dwc2 Merge 5.17-rc6 into usb-next 2022-02-28 21:42:36 +01:00
dwc3 extcon: Fix extcon_get_extcon_dev() error handling 2022-05-13 17:03:40 +09:00
early usb: early: xhci-dbc: Fix xdbc number parsing 2022-03-15 18:20:34 +01:00
gadget usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind() 2022-04-21 19:24:21 +02:00
host xhci: Enable runtime PM on second Alderlake controller 2022-04-21 18:58:54 +02:00
image scsi: Remove drivers/scsi/scsi.h 2022-02-22 21:11:02 -05:00
isp1760 usb: isp1760: remove redundant max_packet() macro 2022-03-15 18:24:02 +01:00
misc usb: misc: eud: Fix an error handling path in eud_probe() 2022-04-21 19:24:10 +02:00
mon
mtu3 usb: mtu3: fix USB 3.0 dual-role-switch from device to host 2022-04-21 19:06:41 +02:00
musb partially Revert "usb: musb: Set the DT node on the child device" 2022-03-15 15:49:15 +01:00
phy extcon: Fix extcon_get_extcon_dev() error handling 2022-05-13 17:03:40 +09:00
renesas_usbhs usb: renesas_usbhs: Use platform_get_irq() to get the interrupt 2021-12-21 08:51:57 +01:00
roles usb: roles: add helper usb_role_string() 2021-05-27 09:17:18 +02:00
serial USB: serial: whiteheat: fix heap overflow in WHITEHEAT_GET_DTR_RTS 2022-04-21 10:08:06 +02:00
storage USB/Thunderbolt patches for 5.18-rc1 2022-03-26 13:08:25 -07:00
typec extcon: Fix extcon_get_extcon_dev() error handling 2022-05-13 17:03:40 +09:00
usbip usb: usbip: eliminate anonymous module_init & module_exit 2022-03-18 12:52:56 +01:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile usb: host: remove line for obsolete config USB_HWA_HCD 2021-08-18 15:32:19 +02:00
usb-skeleton.c usb: usb-skeleton: Update min() to min_t() 2021-10-05 12:56:48 +02:00