Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a664fac1 authored by Liangliang Lu's avatar Liangliang Lu Committed by Gerrit - the friendly Code Review server
Browse files

usb: pd: Assign regulator pointer to NULL if get error code



In the case we get error code from devm_regulator_get() instead
of regulator pointer, pd->vbus will be assigned to error code.
We need to assign NULL to pd->vbus after checking the return
value.

Change-Id: Ibcbdf75b8aa05db5148ed138fb15e60ab60a0182
Signed-off-by: default avatarLiangliang Lu <luliang@codeaurora.org>
parent 58bdd471
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2415,6 +2415,7 @@ static int enable_vbus(struct usbpd *pd)
	if (!pd->vbus) {
		pd->vbus = devm_regulator_get(pd->dev.parent, "vbus");
		if (IS_ERR(pd->vbus)) {
			pd->vbus = NULL;
			usbpd_err(&pd->dev, "Unable to get vbus\n");
			return -EAGAIN;
		}