From patchwork Thu Oct 3 15:53:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 175086 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp510988ill; Thu, 3 Oct 2019 08:57:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvAVb2RQvTt5PLE98HJiVlLKcqtvtDhSKBjw+b/AxNpYXfLKwi0PB3PPVsddLIjlxJ8NIi X-Received: by 2002:a17:906:2542:: with SMTP id j2mr8466565ejb.278.1570118242027; Thu, 03 Oct 2019 08:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570118242; cv=none; d=google.com; s=arc-20160816; b=n0tgTgYe5BPMxYL4kd3SX/l0c890C9aaivlbUJD8cKGFHMHmqZ5/355wLRTS6DcGQk 10a/Oe9uFIbvW4y1FO8uDL797/UDPLi3opDcrvpfDbcI98M/vQfezvt1ZsFU/8wiUJPD aleXPh014/htmi5/yw+kMV58EjTK2+nK0F1sdN/BIdfHCi5AIZGmxNkaGiBpJpPgjWeY TKzg/a+8tv5iHR26cHWjy4jIHr5rTY4OqwINRb79v2TtKS+B8LpFvvn8Zpzldjo1OIh/ DkaFMqSXiPBTuR3pW+puIXftjXJ6tMrSvsdfHoDiSQ4VpNhh+mjwrHJ/VvcdLCeBQRgd hw4A== 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=PIfJhvcYMth2WDkz1jmHhz+yPHt2EDTaxIPKTCMwKRw=; b=0yo8J92/9YZVVGzWXJUSMyuZAgFrvZF7Y1vjQj7V+QZoawaTSp9wiFwcdpfBLD/n0x l6I2wFh2bjhBpJFPTmg2iCU+Rbw8U/pSFa6kvN/7UQAW4tMwcecVk+zarFImNi8z1We3 iTep5Q/xCXsJzdpT11GAHvXT+7iLiW+GTQE/TnXXCQl8edTlW2kU6o2xpuah5jmoU4p/ uYPW1s4gvAngsYrsGsiw/KzGsvXveemCGnuaEo7+AZgM9iMAq57yRsuR/A5Ej95WwgeP /Dd4oIn1NFrCJAuCkHmPoE2qcalgVtr+zdXchzBdL2yxjCQDaEQIe++bGTKiidf7Zscv a6ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BD2Ks0nZ; 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 y54si1972024edb.217.2019.10.03.08.57.21; Thu, 03 Oct 2019 08:57:22 -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; dkim=pass header.i=@kernel.org header.s=default header.b=BD2Ks0nZ; 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 S1730923AbfJCP5U (ORCPT + 27 others); Thu, 3 Oct 2019 11:57:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:39624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfJCP5Q (ORCPT ); Thu, 3 Oct 2019 11:57:16 -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 B99EB21783; Thu, 3 Oct 2019 15:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118236; bh=R1bNk2/hCaKw1ytY+Ws4ld/IUdVpxotA409O+wn8ryo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BD2Ks0nZNR0MU+cY+KTrkfg9z1f3MjHsfuNn7WZkKXOUGGTOzR20gmjlv09wT4+VT 7JmAYQh1REYxvRYc5EzDAimeqwA7+hnGK3PPDpKE6rK4DXHEFJ8YBEigQI+CebdrXA uZpnkCYZMiT15fTz5KyRe5xaI4zsfIUIOJIbCMPI= 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.4 37/99] media: dib0700: fix link error for dibx000_i2c_set_speed Date: Thu, 3 Oct 2019 17:53:00 +0200 Message-Id: <20191003154313.072250631@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154252.297991283@linuxfoundation.org> References: <20191003154252.297991283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 38c03283a4417..e1316c7b7c2e5 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -2418,9 +2418,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); @@ -2496,10 +2500,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;