17 Oct
2017
17 Oct
'17
6:16 p.m.
On Tue, 17 Oct 2017 17:35:18 +0200, Ughreja, Rakesh A wrote:
if (cur_cap == -1) {
dev_dbg(bus->dev, "Invalid capability reg read\n");
break;
}
Since we already have a default case in the current code, can we use it ? I am sending you a untested patch, as proposal.
In general, the value -1 indicates a clear error, and it has to be handled alone, not checking a part of the bits.
I'm fine to add your change in addition, of course. And, I believe it'd be better to make dev_dbg() to dev_err() or dev_warn() in the default case, since the situation is really unexpected.
That being said, feel free to send the patch to change that. I'll apply it to for-next branch, while my fix would go into for-linus as a quick fix.
thanks,
Takashi