mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 08:20:52 +07:00
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: Michael Thalmeier <michael.thalmeier@hale.at> Signed-off-by: Peter Chen <peter.chen@nxp.com>
This commit is contained in:
parent
0340ff83cd
commit
cbb22ebcfb
@ -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);
|
||||
|
||||
return sprintf(buf, "%s\n", ci_role(ci)->name);
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user