* [PATCHv2] si2168: return error if set_frontend is called with invalid parameters
@ 2015-01-16 18:36 Olli Salonen
2015-01-17 12:57 ` Antti Palosaari
0 siblings, 1 reply; 2+ messages in thread
From: Olli Salonen @ 2015-01-16 18:36 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
This patch 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.
v2: remove error message, remove line break to comply with coding style.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/dvb-frontends/si2168.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index 7f966f3..85acc54 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -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;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCHv2] si2168: return error if set_frontend is called with invalid parameters
2015-01-16 18:36 [PATCHv2] si2168: return error if set_frontend is called with invalid parameters Olli Salonen
@ 2015-01-17 12:57 ` Antti Palosaari
0 siblings, 0 replies; 2+ messages in thread
From: Antti Palosaari @ 2015-01-17 12:57 UTC (permalink / raw)
To: Olli Salonen, linux-media
On 01/16/2015 08:36 PM, Olli Salonen wrote:
> This patch 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.
>
> v2: remove error message, remove line break to comply with coding style.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Antti
> ---
> drivers/media/dvb-frontends/si2168.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
> index 7f966f3..85acc54 100644
> --- a/drivers/media/dvb-frontends/si2168.c
> +++ b/drivers/media/dvb-frontends/si2168.c
> @@ -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;
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-17 12:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 18:36 [PATCHv2] si2168: return error if set_frontend is called with invalid parameters Olli Salonen
2015-01-17 12:57 ` Antti Palosaari
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.