linux/drivers/usb/phy
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
..
Kconfig usb: phy: Fix spelling mistake in Kconfig help text 2020-12-09 15:23:47 +01:00
Makefile usb: phy: Add driver for the Ingenic JZ4770 USB transceiver 2020-03-12 09:53:08 +01:00
of.c
phy-ab8500-usb.c usb: phy: phy-ab8500-usb: fix spello of "function" 2020-09-14 16:50:48 +02:00
phy-am335x-control.c usb: phy: am335x: convert to devm_platform_ioremap_resource_byname 2020-07-29 16:49:37 +02:00
phy-am335x-control.h
phy-am335x.c usb: phy-generic: Delete unused platform data 2020-01-15 10:39:20 +01:00
phy-fsl-usb.c usb: phy: fsl-usb: add IRQ check 2021-08-13 13:05:50 +02:00
phy-fsl-usb.h USB: phy: fsl-usb: remove character device usage 2020-07-03 10:18:41 +02:00
phy-generic.c usb: phy: generic: Get the vbus supply 2022-04-26 14:10:54 +02:00
phy-generic.h usb: phy-generic: Delete unused platform data 2020-01-15 10:39:20 +01:00
phy-gpio-vbus-usb.c usb: phy: phy-gpio-vbus-usb: Convert to GPIO descriptors 2020-01-23 19:20:57 +01:00
phy-isp1301-omap.c usb: isp1301-omap: Fix the GPIO include 2021-07-21 10:06:30 +02:00
phy-isp1301.c usb: phy: isp1301: Deduplicate of_find_i2c_device_by_node() 2021-05-24 15:27:17 +02:00
phy-jz4770.c USB: PHY: JZ4770: Remove unnecessary function calls. 2020-12-05 13:39:30 +05:30
phy-keystone.c usb: phy: Replace HTTP links with HTTPS ones 2020-07-15 16:33:51 +02:00
phy-mv-usb.c usb: Remove redundant 'flush_workqueue()' calls 2021-11-17 14:36:57 +01:00
phy-mv-usb.h USB: phy: Use the correct style for SPDX License Identifier 2020-04-23 15:28:14 +02:00
phy-mxs-usb.c usb: phy: phy-mxs-usb: Use of_device_get_match_data() 2021-01-18 18:35:46 +01:00
phy-omap-otg.c extcon: Fix extcon_get_extcon_dev() error handling 2022-05-13 17:03:40 +09:00
phy-tahvo.c USB: phy: tahvo:remove unnecessary debug log 2021-10-05 12:51:07 +02:00
phy-tegra-usb.c usb: phy: tegra: Support OTG mode programming 2021-10-05 12:47:49 +02:00
phy-twl6030-usb.c usb: phy: twl6030: add IRQ checks 2021-08-13 13:05:50 +02:00
phy-ulpi-viewport.c usb: phy-ulpi-viewport: convert to readl_poll_timeout_atomic() 2020-09-25 16:30:05 +02:00
phy-ulpi.c usb: ulpi: Add resource-managed variant of otg_ulpi_create() 2020-01-09 16:21:57 +01:00
phy.c usb: phy: Fix page fault from usb_phy_uevent 2021-07-21 09:48:36 +02:00