From patchwork Thu Oct 3 15:52:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175188 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp635458ill; Thu, 3 Oct 2019 10:32:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQhGiT6heLAfVRT0QtO4eJXJS8DwP5ponjuO2dsPlunPbk9UJr4QPrMfYmBityL79RccEv X-Received: by 2002:a05:6402:78b:: with SMTP id d11mr10960236edy.14.1570123979084; Thu, 03 Oct 2019 10:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570123979; cv=none; d=google.com; s=arc-20160816; b=YNZRNFqc3NMAYzCwI+H0h1PNu+zszq7hxpOdV/YSHR0a/lnD8jB4bclItvfUGlLYIb zA8YaTi2s1QsrbNBPVzIZgO/iF4XjFqGq24kd8ZRUag0AqpHsWpY1RQuuetXA8b9hVqo hgFUzZ0bJIYYslvyCX19knK2gO22rw3moFlxW10SLUy4yBE65W8vZr5xebvQVVtyN5aH y8BIECS5Ci0TTRy4Cj/nVtkEFwPVan9/awbBplx56THR43c5EMkIATl/fusx4lI1t2Lo V3z/0hYPRWY4BSGTM8VCHcqVCo3M3My1r3lHF8M6AVCjKwGjrQqTtvs9mdyFyApIv/z+ kQkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Aq0+OUd2h4NwUlsGLdIQjIwgsyzo6qMH6pwMeYSoQn8=; b=mayh0MpK9XJyWY0AvbNm6umD/wRZPNFSLvAaRyMixDh/vVoxBjkV5VBNWtON4YGka6 qvwVAW2SPv69pKhisMkEXPIdxZlBiORl5IC3QSzh096P9EGPvg44IV7ktDkRS5nD7jck 8I2tNWgbjLR8gewrKefD4bNXYVh1DC9TERtdikOYx064ZYnYvGursfpmYbXQ7Ru3rR1e vXsKc+iQ2vz/99jPLBxBjRJESqCaN3XYsBUcsLrnj1lDr4cF9Njd0+ltOAPNTR0bFxa5 Mru2fqT056d/Z1HQHGrd9yVxfe0JtqrjqvWE6jf14SVZSOxQliw7DOUfZN4G/RLDQSxu 5GHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KVCKStx0; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 e5si1582390ejj.70.2019.10.03.10.32.58; Thu, 03 Oct 2019 10:32:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KVCKStx0; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729041AbfJCRcv (ORCPT + 14 others); Thu, 3 Oct 2019 13:32:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:56898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730823AbfJCQIi (ORCPT ); Thu, 3 Oct 2019 12:08:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BF2320865; Thu, 3 Oct 2019 16:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118916; bh=dN6+/uKXWq+iF1R17oTdBOC8Uzm9ThThdUa5PTr1FtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KVCKStx0846gXadzRB2kB7iQnGO+h2GWXLmlAJqIQmryFAzq/ifDJ8Y+B2LexyhMq DhMKdik+OyodHG0ZIVYkn4YY5iQ8x1qZKWD3/+rR8ukj036R9QfunokuWwTKcZoOrF RCBr5d8hiugDkfQYQHjQeviKhG6V1wLVJSY8loV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 058/185] media: dib0700: fix link error for dibx000_i2c_set_speed Date: Thu, 3 Oct 2019 17:52:16 +0200 Message-Id: <20191003154450.386437023@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154437.541662648@linuxfoundation.org> References: <20191003154437.541662648@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit 765bb8610d305ee488b35d07e2a04ae52fb2df9c ] When CONFIG_DVB_DIB9000 is disabled, we can still compile code that now fails to link against dibx000_i2c_set_speed: drivers/media/usb/dvb-usb/dib0700_devices.o: In function `dib01x0_pmu_update.constprop.7': dib0700_devices.c:(.text.unlikely+0x1c9c): undefined reference to `dibx000_i2c_set_speed' The call sites are both through dib01x0_pmu_update(), which gets passed an 'i2c' pointer from dib9000_get_i2c_master(), which has returned NULL. Checking this pointer seems to be a good idea anyway, and it avoids the link failure in most cases. Sean Young found another case that is not fixed by that, where certain gcc versions leave an unused function in place that causes the link error, but adding an explict IS_ENABLED() check also solves this. Fixes: b7f54910ce01 ("V4L/DVB (4647): Added module for DiB0700 based devices") Signed-off-by: Arnd Bergmann Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/dvb-usb/dib0700_devices.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.20.1 diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index 9be1e658ef47e..969358f57d91a 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -2438,9 +2438,13 @@ static int dib9090_tuner_attach(struct dvb_usb_adapter *adap) 8, 0x0486, }; + if (!IS_ENABLED(CONFIG_DVB_DIB9000)) + return -ENODEV; if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL) return -ENODEV; i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); + if (!i2c) + return -ENODEV; if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0) return -ENODEV; dib0700_set_i2c_speed(adap->dev, 1500); @@ -2516,10 +2520,14 @@ static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap) 0, 0x00ef, 8, 0x0406, }; + if (!IS_ENABLED(CONFIG_DVB_DIB9000)) + return -ENODEV; i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe); if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL) return -ENODEV; i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); + if (!i2c) + return -ENODEV; if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0) return -ENODEV;