Skip to content

Commit

Permalink
[media] dvb-frontends: fix potential NULL pointer dereference in stv0…
Browse files Browse the repository at this point in the history
…900_set_mclk()

The dereference should be moved below the NULL test.
dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Wei Yongjun authored and Mauro Carvalho Chehab committed Oct 25, 2012
1 parent 8163ec0 commit b0f9bf3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/media/dvb-frontends/stv0900_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,15 @@ static enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32
{
u32 m_div, clk_sel;

dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk,
intp->quartz);

if (intp == NULL)
return STV0900_INVALID_HANDLE;

if (intp->errs)
return STV0900_I2C_ERROR;

dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk,
intp->quartz);

clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6);
m_div = ((clk_sel * mclk) / intp->quartz) - 1;
stv0900_write_bits(intp, F0900_M_DIV, m_div);
Expand Down

0 comments on commit b0f9bf3

Please sign in to comment.