From patchwork Fri Jan 16 12:35:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 5648111 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 B544B9F3A0 for ; Fri, 16 Jan 2015 12:35:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E5DC120148 for ; Fri, 16 Jan 2015 12:35:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65FDA200D9 for ; Fri, 16 Jan 2015 12:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752629AbbAPMfg (ORCPT ); Fri, 16 Jan 2015 07:35:36 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:65257 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072AbbAPMff (ORCPT ); Fri, 16 Jan 2015 07:35:35 -0500 Received: by mail-lb0-f179.google.com with SMTP id z11so18212553lbi.10 for ; Fri, 16 Jan 2015 04:35:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=r4ZBLLxPvxQrmcuv6LUM7MHoBIlF1NzkwFi5kxefJiE=; b=Jai3YYo9xV/PFG3/60EuuTNpDrgsXTXaryru3pbv1Ya2rpZHTUeZIK8xUJZN71mgRh iOQWHI6ALhhavxMxeoGprVwJO0yFKHLe9KdZje3OYd79sTQT4WhPCZK/QDD5L05gOdjq x14x5frF/cLoU3MsgAh/qhjPDd7cZ6sgZls/opi5uJRXvybFNQjQrY6N6yfN3ny3yiv9 LxwqU5T8UeLVb7yhl8Tl4k18zi+3SHQJSOaeE0SFsm1/cBmnR7bPPXdblGBTq/r2TItq VZfsgrQqie37/LIwJHjy+Z7/yGirFjBP2OZx4QB+OYtBk/LsSjFMAjHQj93IkSM4WPUr dPvg== X-Gm-Message-State: ALoCoQlelAr/fR1l8yZV9OJtC8F2TBBdimJyPtuszUlgrYcWuN//Q9NwEKXcsrgfyLnwBir42Cuz X-Received: by 10.152.4.233 with SMTP id n9mr15411305lan.61.1421411734080; Fri, 16 Jan 2015 04:35:34 -0800 (PST) Received: from dl160.lan (37-33-15-55.bb.dnainternet.fi. [37.33.15.55]) by mx.google.com with ESMTPSA id rb2sm852998lbb.19.2015.01.16.04.35.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Jan 2015 04:35:31 -0800 (PST) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 1/2] si2168: return error if set_frontend is called with invalid parameters Date: Fri, 16 Jan 2015 14:35:19 +0200 Message-Id: <1421411720-2364-1-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 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, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 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. Cc-to: Antti Palosaari Signed-off-by: Olli Salonen Reviewed-by: Antti Palosaari --- drivers/media/dvb-frontends/si2168.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c index 7f966f3..7fef5ab 100644 --- a/drivers/media/dvb-frontends/si2168.c +++ b/drivers/media/dvb-frontends/si2168.c @@ -180,7 +180,12 @@ static int si2168_set_frontend(struct dvb_frontend *fe) goto err; } - if (c->bandwidth_hz <= 5000000) + if (c->bandwidth_hz == 0) { + ret = -EINVAL; + dev_err(&client->dev, "automatic bandwidth not supported"); + goto err; + } + else if (c->bandwidth_hz <= 5000000) bandwidth = 0x05; else if (c->bandwidth_hz <= 6000000) bandwidth = 0x06;