From patchwork Wed Mar 16 11:02: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: 8598161 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8E3F1C0553 for ; Wed, 16 Mar 2016 11:03:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C34C2201EF for ; Wed, 16 Mar 2016 11:03:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C2492008F for ; Wed, 16 Mar 2016 11:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753861AbcCPLDj (ORCPT ); Wed, 16 Mar 2016 07:03:39 -0400 Received: from mail-lb0-f195.google.com ([209.85.217.195]:34818 "EHLO mail-lb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966646AbcCPLDh (ORCPT ); Wed, 16 Mar 2016 07:03:37 -0400 Received: by mail-lb0-f195.google.com with SMTP id wn5so3058112lbb.2 for ; Wed, 16 Mar 2016 04:03:36 -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=TloOEVzEh7i1FvOSQKglmiQfXBzqu7/pKhEwvOBnZz0=; b=Ga2AOzjKGQgGxWGRJuOA3XXk8i+DrgRWjyqR5F1OYBo++6q5gw24McBfo+FbYuq/s4 s7QzCPU5RT9zvdnLhzyKoConw3D6B9vs8TmWRttODiiSL7MGzP/sizEBdaTXOPp5Ao4D PK/vC4VJTsTnrEkwhwObjv7uttRg1Y1fmVBTHhsoJZVwFbe5K/o1xkYFqiax8oG4Lv98 8a2XkxZm6QXWe2sOqEiUIuZwfIr6wXA1L81AMHYqy0XCbzWJMq4aBPU3Qq+m0Fivcd6H oU7xmc68kV34UxEQ+jZsRQNwUywo5OwXJh8spP5masy/zP1C5kIS/Mth+X99Y5TG3soF mIQg== X-Gm-Message-State: AD7BkJKbsqeL5MT7qTj1WGEjFQqYAxGzmsf9f2OFTCQ1t7lgtjs5R9jL73k8Ojsr8pip8w== X-Received: by 10.112.163.102 with SMTP id yh6mr1144867lbb.4.1458126215793; Wed, 16 Mar 2016 04:03:35 -0700 (PDT) Received: from dl160.lan (178-55-1-76.bb.dnainternet.fi. [178.55.1.76]) by smtp.gmail.com with ESMTPSA id i8sm426382lbj.30.2016.03.16.04.03.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Mar 2016 04:03:35 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 1/2] ds3000: return meaningful return codes Date: Wed, 16 Mar 2016 13:02:51 +0200 Message-Id: <1458126171-13871-2-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458126171-13871-1-git-send-email-olli.salonen@iki.fi> References: <1458126171-13871-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. 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;