Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2514346imm; Thu, 7 Jun 2018 11:58:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLalEXlHIBIvOhGvjfd9GAAs7mMJQ5/FU8Z5H2vmj/hJ7YjBjVdafoYg6TuhcTXjlXV2E1A X-Received: by 2002:a17:902:5489:: with SMTP id e9-v6mr3161575pli.137.1528397885564; Thu, 07 Jun 2018 11:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528397885; cv=none; d=google.com; s=arc-20160816; b=lFoLzSfLmtFUfujZknW2zO1+jaXxpU2u0rnc+gAJedYI+TxX2wR6ZEHFQgf0KHRyPj P1febE57mPuocaiYQkQr46SczAXUoiSUAN43ck9WoeGmzzFAyiaujUVq3qZpILdaKwHp 3gECjNBGmqac0zOuE5Y+AMlzqMffCZsMdgZNYrrwdY+iX2WQ8A8D9n5jRb+jhtlH1uS0 OhwnNZO41bHhn37AnaRt3/4z0AzrqiSm7stKRkdPO4ky6Vx2MhYOqvB7xhimPIsk6uVj jAL5ioQla0rcWFi6r4gqwq5IlGk9DXymzavN+N5w2JwK2W5TP80ojNapb2N1ht6AkLia r+jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=KsJe8t7YthcA8DucBLY6fsA8tlpdUbsB8H9Q61OqBjQ=; b=wDI4cvW78qKTMu+tOQW7jhUZkCugU3dCSVv+GryG+SmP8RERLof/tcIJDpFoQDIl8f MqqlW5wD6A7JcDQpYrhSAxPOm2cAiJshb0YLgT1DoaQOX/6qlXypwIM8305DD4aJpmWQ 3KjpoeeaV5Q+t6BEwIrVMXLq4jPl6BigWQtVgdqZ0eARVEIjRIodlTk7pzpVbC923fnI EhXLrVjTtiMxaO6ea08BO8pcSCh0YBwlarNUftDfuIC9kpbmxQuUz9Kru+yuHhAtt+wf D0+n7I5Atm6nCrdmGeME4jS8K5R6YX9q2i4mPRgKPoHBBPcOWTmXVNROM2mqaUXClcof mtqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o16-v6si17496754pgd.12.2018.06.07.11.57.51; Thu, 07 Jun 2018 11:58:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936135AbeFGQPm (ORCPT + 99 others); Thu, 7 Jun 2018 12:15:42 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39097 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932879AbeFGOI6 (ORCPT ); Thu, 7 Jun 2018 10:08:58 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvay-0005Zq-7s; Thu, 07 Jun 2018 15:08:56 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvax-0002gf-7W; Thu, 07 Jun 2018 15:08:55 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Andrey Konovalov" , "Mauro Carvalho Chehab" , "Malcolm Priestley" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 008/410] media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Malcolm Priestley commit 7bf7a7116ed313c601307f7e585419369926ab05 upstream. 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 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Ben Hutchings --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1115,8 +1115,6 @@ static int dm04_lme2510_frontend_attach( 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; @@ -1179,17 +1177,18 @@ static int dm04_lme2510_tuner(struct dvb 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; }