Skip to content

Commit

Permalink
[media] si2168: return error if set_frontend is called with invalid p…
Browse files Browse the repository at this point in the history
…arameters

This patch should is based on Antti's silabs branch.

According to dvb-frontend.h set_frontend may be called with bandwidth_hz set to 0 if automatic bandwidth is required. Si2168 does not support automatic bandwidth and does not declare FE_CAN_BANDWIDTH_AUTO in caps.

This patch will change the behaviour in a way that EINVAL is returned if bandwidth_hz is 0.

Signed-off-by: Olli Salonen <[email protected]>
Reviewed-by: Antti Palosaari <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
trsqr authored and mchehab committed Feb 3, 2015
1 parent 3656cdd commit 683e98b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/media/dvb-frontends/si2168.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
goto err;
}

if (c->bandwidth_hz <= 5000000)
if (c->bandwidth_hz == 0) {
ret = -EINVAL;
goto err;
} else if (c->bandwidth_hz <= 5000000)
bandwidth = 0x05;
else if (c->bandwidth_hz <= 6000000)
bandwidth = 0x06;
Expand Down

0 comments on commit 683e98b

Please sign in to comment.