Skip to contentSkip to conversation

usb: phy: don't return with NULL from devm_usb_get_phy()

PATCH New Gabor Juhos 1 participant 1 message Oct 11, 2013 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: phy: don't return with NULL from devm_usb_get_phy()

The callers are expecting an ERR_PTR value in case of an error. Change he code to return with an encoded -ENOMEM value in the case of a failed devres_alloc call.

---
 drivers/usb/phy/phy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/phy.c +1 -1
index a9984c7..1b74523 100644
@@ -98,7 +98,7 @@ struct usb_phy *devm_usb_get_phy(struct device *dev, enum usb_phy_type type)
 
 	ptr = devres_alloc(devm_usb_phy_release, sizeof(*ptr), GFP_KERNEL);
 	if (!ptr)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	phy = usb_get_phy(type);
 	if (!IS_ERR(phy)) {
Signature · 1 line
1.7.10