提交 23e64d55 编写于 作者: D Dan Carpenter 提交者: Mauro Carvalho Chehab

V4L/DVB: saa7164: move dereference under NULL check

The original code dereferenced "port" before checking it for NULL.  I
moved the test down below the check.  Also I changed the comparisons a
little so people wouldn't get confused and think "port" and "buf" were
ints instead of pointers.  (Probably that's what lead to this issue in
the first place.)

There is only one caller for this function and it passes non-NULL
pointers, so this is essentially a cleanup rather than a bugfix.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 d5337966
...@@ -136,10 +136,11 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_tsport *port, ...@@ -136,10 +136,11 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_tsport *port,
int saa7164_buffer_dealloc(struct saa7164_tsport *port, int saa7164_buffer_dealloc(struct saa7164_tsport *port,
struct saa7164_buffer *buf) struct saa7164_buffer *buf)
{ {
struct saa7164_dev *dev = port->dev; struct saa7164_dev *dev;
if ((buf == 0) || (port == 0)) if (!buf || !port)
return SAA_ERR_BAD_PARAMETER; return SAA_ERR_BAD_PARAMETER;
dev = port->dev;
dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf); dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册