From patchwork Thu Oct 3 15:50:17 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: 175145 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp570497ill; Thu, 3 Oct 2019 09:40:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSUHc/5FEdByLrG1khcSaim5AqQvbbz1cPlnEFhcBOYqzGAtn4Z+BVZTEWPHrvNEfGHCWT X-Received: by 2002:a17:906:b804:: with SMTP id dv4mr8388259ejb.243.1570120832154; Thu, 03 Oct 2019 09:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120832; cv=none; d=google.com; s=arc-20160816; b=LjRis9vIseZ2ZUwFJF8oVObfGeQLMhfY6bNTeBOo/h7C9ywrpxTXdAoha6P82u0a3N oqiuycmHxfEghUTC4FTutEQGiW22zyyM0wAj8jv10wSkDt8PJwD0FnyBBkZOTFp8h4lQ nj+fzJ23Y+beAuaz5E1yYbKM1K2MDhIbXr7obTKcK2SfiQCkaXRLt8kbSqVdqqaA19UO YHhEKRe5TXoqH+WwC5jFK3DTE+Z0nbLhOo4hZWvFjBbXcnT5yVR4vCkp3jZwupQe8vpE tT2R+er9uwxycqMC/5wACOBmnGqxxoeCx9BeUsZsqnWcfLtPkB11/vOxbSkATDfdjSuH FPtg== 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=QHVLwMC1p3AYP9xxLitC8cEk9nOs4UkOszNh6XmzQvo=; b=suM+k9Um5pVpC/Q9PoLx58ZFyvmDoquymX+7hOPVB7rm7RjGSODHCPPP0IMtJb9Ill 7Rc+GV/R+IIEv80u9KfjD4XEoW8Of+29QLuccCzPP9/HWF9ZhE1WP0L6UAWuh7Pbtfjt lUEOstIDew3wOItogV3yIviOM8EKWlEj5FCGE5JB2ij1tU7LBA/CUjldRGG2L0HMf4BP w8in3Pj9G3X+lcl26p54JhQd6D4Ff1B0cqgqHLNZ2W95IHTQ9vzpHO9kg5823wTA5ahR GnJOpbCQIC/JAW8sFqbWuJoABDlOQucu7F271gK/xoeza57Gk1uCIMWRyouq6Skcd08I bvLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uA+N0BME; 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 t37si2018033edd.25.2019.10.03.09.40.31; Thu, 03 Oct 2019 09:40:32 -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=uA+N0BME; 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 S2404425AbfJCQk2 (ORCPT + 14 others); Thu, 3 Oct 2019 12:40:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:50650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404204AbfJCQk1 (ORCPT ); Thu, 3 Oct 2019 12:40:27 -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 AD71A2070B; Thu, 3 Oct 2019 16:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120827; bh=48xQrCMOZWQY0GMUtiT7ORhyY7JKh36Uou8DfkPsZ14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uA+N0BMEI+oCWvxP7MxzRTBkzKKKIBPRDXrqvKOTdC/2W6ydojmeGAbVtpDT4eNk6 j57vyf2JF6/hnYbCkL52Q2LLZ5UjIWkjAM7GCuk87gXVuaN64dH1qoSNIcHvr/LYXz 9Pn8ZlVpKjlaQ3/vEXGgIUYU3Pk5yD5XwzDn7ngQ= 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 5.3 052/344] media: dib0700: fix link error for dibx000_i2c_set_speed Date: Thu, 3 Oct 2019 17:50:17 +0200 Message-Id: <20191003154545.281559676@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154540.062170222@linuxfoundation.org> References: <20191003154540.062170222@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 66d685065e065..ab7a100ec84fe 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -2439,9 +2439,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); @@ -2517,10 +2521,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;