usb: chipidea: debug: check before accessing ci_role

ci_role BUGs when the role is >= CI_ROLE_END.

Cc: stable@vger.kernel.org  #v3.10+
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
This commit is contained in:
Michael Thalmeier 2017-05-18 16:14:14 +02:00 committed by Peter Chen
parent aa1f058d7d
commit 0340ff83cd
1 changed files with 2 additions and 1 deletions

View File

@ -294,7 +294,8 @@ static int ci_role_show(struct seq_file *s, void *data)
{
struct ci_hdrc *ci = s->private;
seq_printf(s, "%s\n", ci_role(ci)->name);
if (ci->role != CI_ROLE_END)
seq_printf(s, "%s\n", ci_role(ci)->name);
return 0;
}