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

Commit cbb22ebc authored by Michael Thalmeier's avatar Michael Thalmeier Committed by Peter Chen
Browse files

usb: chipidea: core: check before accessing ci_role in ci_role_show



ci_role BUGs when the role is >= CI_ROLE_END.
This is the case while the role is changing.

Signed-off-by: default avatarMichael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
parent 0340ff83
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -843,7 +843,10 @@ static ssize_t ci_role_show(struct device *dev, struct device_attribute *attr,
{
	struct ci_hdrc *ci = dev_get_drvdata(dev);

	if (ci->role != CI_ROLE_END)
		return sprintf(buf, "%s\n", ci_role(ci)->name);

	return 0;
}

static ssize_t ci_role_store(struct device *dev,