From patchwork Tue Sep 26 21:10:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 9972747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DEBE36037E for ; Tue, 26 Sep 2017 21:10:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D17DF287C1 for ; Tue, 26 Sep 2017 21:10:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C641D287E7; Tue, 26 Sep 2017 21:10:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 577FC287C1 for ; Tue, 26 Sep 2017 21:10:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754596AbdIZVK6 (ORCPT ); Tue, 26 Sep 2017 17:10:58 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:46136 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754588AbdIZVK5 (ORCPT ); Tue, 26 Sep 2017 17:10:57 -0400 Received: by mail-wm0-f68.google.com with SMTP id m72so12010340wmc.1 for ; Tue, 26 Sep 2017 14:10:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PI9E1KEUl2JtlcOhKZQKvtYID5mO0JJM0hGG/yJ6qjM=; b=VnEUK7hORMe6VgKRm4NtgkNwWAU9Go44XMjZL8kaioVvkezWQ42lM32KKmE1JKIaPm h9VYM7DI8eNMkEGFzhC2buk9ir3om2jGe9AyhmHjkbcZGB2kPqY6Ot9FnVIJS9tzmMWV UEfOG72LeXzGIfVBcUyrwtgiD0II0YE0VJnJzTE+MxIT84NWFRt6LT7n5xy+rT2AIWqD jb3iN6qqcbPBzc1f4PDzjw90+YschIir/feq4ahDfiQm3swgEHe1ydc5F4nBArAFgPEw 5NrwqEDBDelCZLcq8ggxp+UgeD4pnnhVxkMjvMHc+hT3+YP4SHO8CzUFfE2Q+VXGBLKa ZahQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PI9E1KEUl2JtlcOhKZQKvtYID5mO0JJM0hGG/yJ6qjM=; b=GdQm8luGg2z4IUwy2qVrC+HSjH81ACWjRZTRFM/Es8DDXAGbPW0MwmBAXi5XlkeC4J YH4oEW2d7XBQyx4+Gz+4QfBJKgyUW2gFDsoeOVTV9T/Lg/L+XEK7mycfjpUrDf+NGr5K ZPrLCDDT4qWMUOEYE1GpTg+DNG7XGaixvG8RIx9x83ZRQEajCXdEPgmss3amwNzPJ0J5 sIPg9evpkdErK4Vby18OOer4PUdISAhOpPiABnXgcRBTc22yMWUvYNnJwro1JIWbRzXx Szwja4aYM0BWN0z0orWZFl5KeKrJS1f5PhE28o1GLYazC6zwoG37Rc4N+OoL3Xs8Egsq +1zg== X-Gm-Message-State: AHPjjUiJ809ofMZQ8VN81x+71qcR37ENzAK2As/FJPUFs/S/yIdJ42qd 31/SOADPX7Kl3wcUjLGtKZgbWLZv X-Google-Smtp-Source: AOwi7QAlfbGuhR8lEZEEw0knWQYog7G9K0EzTQXU4W5tLUgWSFFD1rcFqyE0OjgeQAMb80/5VRdbEg== X-Received: by 10.28.59.215 with SMTP id i206mr4230481wma.116.1506460255833; Tue, 26 Sep 2017 14:10:55 -0700 (PDT) Received: from localhost.localdomain (92.40.248.221.threembb.co.uk. [92.40.248.221]) by smtp.gmail.com with ESMTPSA id n9sm4102939wmd.12.2017.09.26.14.10.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 14:10:55 -0700 (PDT) From: Malcolm Priestley To: linux-media@vger.kernel.org Cc: Andrey Konovalov , Malcolm Priestley Subject: [PATCH 2/2] media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner Date: Tue, 26 Sep 2017 22:10:21 +0100 Message-Id: <20170926211021.11036-2-tvboxspy@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170926211021.11036-1-tvboxspy@gmail.com> References: <20170926211021.11036-1-tvboxspy@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the tuner was split from m88rs2000 the attach function is in wrong place. Move to dm04_lme2510_tuner to trap errors on failure and removing a call to lme_coldreset. Prevents driver starting up without any tuner connected. Fixes to trap for ts2020 fail. LME2510(C): FE Found M88RS2000 ts2020: probe of 0-0060 failed with error -11 ... LME2510(C): TUN Found RS2000 tuner kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN Reported-by: Andrey Konovalov Signed-off-by: Malcolm Priestley Tested-by: Andrey Konovalov --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 992f2011a6ba..be26c029546b 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1076,8 +1076,6 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) if (adap->fe[0]) { info("FE Found M88RS2000"); - dvb_attach(ts2020_attach, adap->fe[0], &ts2020_config, - &d->i2c_adap); st->i2c_tuner_gate_w = 5; st->i2c_tuner_gate_r = 5; st->i2c_tuner_addr = 0x60; @@ -1143,17 +1141,18 @@ static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap) ret = st->tuner_config; break; case TUNER_RS2000: - ret = st->tuner_config; + if (dvb_attach(ts2020_attach, adap->fe[0], + &ts2020_config, &d->i2c_adap)) + ret = st->tuner_config; break; default: break; } - if (ret) + if (ret) { info("TUN Found %s tuner", tun_msg[ret]); - else { - info("TUN No tuner found --- resetting device"); - lme_coldreset(d); + } else { + info("TUN No tuner found"); return -ENODEV; }