From 5957797805e8a3fab201a3a647af13510efd6151 Mon Sep 17 00:00:00 2001 From: Daniel Brát Date: Wed, 20 Oct 2021 10:39:54 +0200 Subject: phy: core: Make 'phy_optional_get' return NULL when not implemented MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make 'phy_optional_get' return NULL instead of ERR_PTR(-ENOSYS) when the CONFIG_GENERIC_PHY is not enabled. It makes more sense to return NULL instead of straight up throwing a error since the function has 'optional' in its name. This also fixes dwc2 usb driver which would previously fail inside its probe function despite being able to function without a phy just fine. Signed-off-by: Daniel Brát Link: https://lore.barebox.org/20211020083954.3787-1-danek.brat@gmail.com Signed-off-by: Sascha Hauer --- include/linux/phy/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 679ce6e420..321e546f90 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -195,7 +195,7 @@ static inline struct phy *phy_get(struct device_d *dev, const char *string) static inline struct phy *phy_optional_get(struct device_d *dev, const char *string) { - return ERR_PTR(-ENOSYS); + return NULL; } static inline struct phy *of_phy_get_by_phandle(struct device_d *dev, -- cgit v1.2.3