mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
media: ddbridge: check pointers before dereferencing
Fixes two warnings reported by smatch: drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'idev' (see line 238) drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'pdev' (see line 238) Fixed by moving the existing checks up before accessing members. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
69716934c7
commit
e89e02a865
1 changed files with 2 additions and 2 deletions
|
@ -170,10 +170,10 @@ static int ddb_redirect(u32 i, u32 p)
|
|||
struct ddb *pdev = ddbs[(p >> 4) & 0x3f];
|
||||
struct ddb_port *port;
|
||||
|
||||
if (!idev->has_dma || !pdev->has_dma)
|
||||
return -EINVAL;
|
||||
if (!idev || !pdev)
|
||||
return -EINVAL;
|
||||
if (!idev->has_dma || !pdev->has_dma)
|
||||
return -EINVAL;
|
||||
|
||||
port = &pdev->port[p & 0x0f];
|
||||
if (!port->output)
|
||||
|
|
Loading…
Reference in a new issue