Skip to content

Commit b7fa5c2

Browse files
author
Felipe Balbi
committed
usb: phy: return -ENXIO when PHY layer isn't enabled
in cases where PHY layer isn't enabled, we want to still return an error code (actually an error pointer) so that our users don't need to cope with either error pointer of NULL. This will simplify users as below: - return IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV; + return PTR_ERR(phy); Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Reported-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parent 3bf6db9 commit b7fa5c2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎include/linux/usb/phy.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,29 +197,29 @@ extern int usb_bind_phy(const char *dev_name, u8 index,
197197
#else
198198
static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
199199
{
200-
return NULL;
200+
return ERR_PTR(-ENXIO);
201201
}
202202

203203
static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
204204
enum usb_phy_type type)
205205
{
206-
return NULL;
206+
return ERR_PTR(-ENXIO);
207207
}
208208

209209
static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
210210
{
211-
return NULL;
211+
return ERR_PTR(-ENXIO);
212212
}
213213

214214
static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
215215
{
216-
return NULL;
216+
return ERR_PTR(-ENXIO);
217217
}
218218

219219
static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
220220
const char *phandle, u8 index)
221221
{
222-
return NULL;
222+
return ERR_PTR(-ENXIO);
223223
}
224224

225225
static inline void usb_put_phy(struct usb_phy *x)

0 commit comments

Comments
 (0)