From patchwork Wed Mar 16 11:04:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 8598261 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7C4049F3D1 for ; Wed, 16 Mar 2016 11:05:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A911B2022A for ; Wed, 16 Mar 2016 11:05:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB628202BE for ; Wed, 16 Mar 2016 11:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966465AbcCPLFV (ORCPT ); Wed, 16 Mar 2016 07:05:21 -0400 Received: from mail-lb0-f170.google.com ([209.85.217.170]:34539 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965106AbcCPLFQ (ORCPT ); Wed, 16 Mar 2016 07:05:16 -0400 Received: by mail-lb0-f170.google.com with SMTP id k12so45317918lbb.1 for ; Wed, 16 Mar 2016 04:05:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IUI+kAatKr6Ele4SOTf9SbYvaWUSquGz/dwT5OgU+vw=; b=OHm0sS5CqYSbZTD2ffIjN3aHhJFfhUw+w4TJItXVFWsjnRnqeSPIHzKon5vw5h4ipi hZL+r/coa3WZ4Q72jRfeevmGtTt/5h5qpVyX8AjVW7TK+bC5K1P0ner2Ya8uV7v3fSoD 9cZwMYgG5uDwSwKxCZsFTTmwZLSra9QqsGFviXAPCxPsmz6IubA1VODvNhSGrJ+ht6ah RNzbCx8RUxRBG8z8vHarsPh/v5EehllwHHmQQlf0MK2JYVb+orv2Axn5XMDvfiezrfW2 PYYQYsO2hBJMXo+rJ0cmD5RHoXk4acDX0KNMdpqNT4r0X1BLZQPWCWfurjMKa2BCLnmG cEDw== X-Gm-Message-State: AD7BkJKwfz+VyfOjOVXeBoB9iiUmDEr8buq1ann8mwzFf9c7D8awXN5A+rAV72xrQ88Rnw== X-Received: by 10.112.62.229 with SMTP id b5mr485563lbs.30.1458126314526; Wed, 16 Mar 2016 04:05:14 -0700 (PDT) Received: from dl160.lan (178-55-1-76.bb.dnainternet.fi. [178.55.1.76]) by smtp.gmail.com with ESMTPSA id o1sm446184lbc.26.2016.03.16.04.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Mar 2016 04:05:13 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCHv2 2/2] ds3000: return error if invalid symbol rate is set Date: Wed, 16 Mar 2016 13:04:51 +0200 Message-Id: <1458126291-13914-2-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458126291-13914-1-git-send-email-olli.salonen@iki.fi> References: <1458126291-13914-1-git-send-email-olli.salonen@iki.fi> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Return -EINVAL if ds3000_set_frontend is called with invalid parameters. v1 of the patch series got incorrect subject lines. Signed-off-by: Olli Salonen --- drivers/media/dvb-frontends/ds3000.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index addffc3..447b518 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c @@ -959,6 +959,15 @@ static int ds3000_set_frontend(struct dvb_frontend *fe) /* enable ac coupling */ ds3000_writereg(state, 0x25, 0x8a); + if ((c->symbol_rate < ds3000_ops.info.symbol_rate_min) || + (c->symbol_rate > ds3000_ops.info.symbol_rate_max)) { + dprintk("%s() symbol_rate %u out of range (%u ... %u)\n", + __func__, c->symbol_rate, + ds3000_ops.info.symbol_rate_min, + ds3000_ops.info.symbol_rate_max); + return -EINVAL; + } + /* enhance symbol rate performance */ if ((c->symbol_rate / 1000) <= 5000) { value = 29777 / (c->symbol_rate / 1000) + 1;