media: ddbridge: make (ddb)readl in while-loops fail-safe
authorDaniel Scheller <d.scheller@gmx.net>
Fri, 23 Jun 2017 16:37:40 +0000 (13:37 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sat, 24 Jun 2017 12:41:30 +0000 (09:41 -0300)
commitd52786ddd2d52f90db5ba30a185d641771e27167
tree1cc7adecca796f61a59faae51ae9994e8c3b0fa0
parentcb778f5c8581c9c17cc4e420890e5589d948d584
media: ddbridge: make (ddb)readl in while-loops fail-safe

Reported by smatch:

  drivers/media/pci/ddbridge/ddbridge-core.c:1246 input_tasklet() warn: this loop depends on readl() succeeding
  drivers/media/pci/ddbridge/ddbridge-core.c:1768 flashio() warn: this loop depends on readl() succeeding
  drivers/media/pci/ddbridge/ddbridge-core.c:1788 flashio() warn: this loop depends on readl() succeeding

Fix this by introducing safe_ddbreadl() which will wrap ddbreadl and checks
for all bits set in the return which indicates failure, and return 0 in
that case. Usable as drop-in-replacement in all affected while loops w/o
having to change the logic.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/ddbridge/ddbridge-core.c