From patchwork Fri Jan 16 18:36:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 5649931 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 63F04C058D for ; Fri, 16 Jan 2015 18:36:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADDA5202FE for ; Fri, 16 Jan 2015 18:36:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3ED520303 for ; Fri, 16 Jan 2015 18:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752180AbbAPSgv (ORCPT ); Fri, 16 Jan 2015 13:36:51 -0500 Received: from mail-la0-f43.google.com ([209.85.215.43]:57530 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751896AbbAPSgu (ORCPT ); Fri, 16 Jan 2015 13:36:50 -0500 Received: by mail-la0-f43.google.com with SMTP id q1so5015032lam.2 for ; Fri, 16 Jan 2015 10:36:49 -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=lId7r8hpi5QwgyrWBpkf0XnvEfFfn3OuffzYJEHL4ZM=; b=Pu9mjBS7XyO8qzCi5wq/GSQs5wxwRGvP8HsZh+0FH5x5aKpboxAvjrneaBoixyzvHF SRl4h+X/EQsdApKRdXu+nPoyy1YNKAFQyzynSwEmKflDEBZ0HWPEuzc2mWAgzAar40Lb Ctguot//cUiJuAVRxa978xnvzLH3PpGG7f1OCZUhpk44lC0R6x9RSuLDwIgX0RIiBV6d tu8V70aNzVofeHOtpRJ0Y+KqihJ2tl4jk/SaS8votdzj6EC5ThuBYXlhDyY46Ti9H/CO +Rz0cEli1GbgWlAOcLRus+ScjIhgXwHSkg2/BgEslr8jd8QCYzUWnBgG44Ij4ftOYM3E MvRA== X-Gm-Message-State: ALoCoQln0QoSBeUALV6nxMJ991Suqki6mJe0GFVmiPYDnH0Wc6WWSJ3Yp5HpuvoW7H/cck2T1Nuz X-Received: by 10.112.64.35 with SMTP id l3mr17035757lbs.82.1421433409127; Fri, 16 Jan 2015 10:36:49 -0800 (PST) Received: from dl160.lan (37-33-15-55.bb.dnainternet.fi. [37.33.15.55]) by mx.google.com with ESMTPSA id 10sm1633180lar.24.2015.01.16.10.36.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Jan 2015 10:36:48 -0800 (PST) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCHv2] si2168: return error if set_frontend is called with invalid parameters Date: Fri, 16 Jan 2015 20:36:38 +0200 Message-Id: <1421433398-1541-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=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 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 Reviewed-by: Antti Palosaari --- 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;