From patchwork Thu Oct 3 15:50:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175128 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp554168ill; Thu, 3 Oct 2019 09:27:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvfmRlNZTvS1rEoKuSV41qGsOZq9AIX9MwJU7i0G86cFRaMQT5a3E7Iv5G4JguOzLKarEI X-Received: by 2002:a50:9e26:: with SMTP id z35mr10399765ede.265.1570120066606; Thu, 03 Oct 2019 09:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120066; cv=none; d=google.com; s=arc-20160816; b=NRdmnu+qHzPSk5XsPc+Ax1KR6HFo5dQTuPrXXIqSN6DmkrJcRhaD2IVsrcN6VGnra5 wYtDlpTcHnBDAu+/f8z7nQMRO257gHb21mz7llFoZhAm1v2YRH2fmGi2qjQ0xfCJ9V+E Hmjmi8Q0jEhzzwIfHUNzjapwWRxcA1NX6P+ZWVb7vtwjUGHKwTVHYfFrWNfltJHln/yk Ryi0wkFS7+ZdyNhRTnjc/h2Pr83p8EMl7DzJKPDju0Fi5cmAmJgMVoTe04bgLghK+48u SW0Re1lCbKJvQZGW8lVTGyeeD6f98E8xKc/exJWv/zSKCa5DEQHcwFkv7iC6qf47413h zjZw== 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=uXnJagvapnXgz/9jBpovezEBOOivtkh2sbjfDgAvDa/BkdZ9EadQRBVIFn7sViPugR eNXPmp9kYJMfkuRsm/s/GTvXw0NymrktrMlU988VidT1BMIEO4JtJFgR1kh1kJAhGIJQ i9xljCo16R8XlUK1U9l514y7XlM3Q67BSgICZN84in+5PXazya3pZsgrglmSvuQUd8My hnJLJZlACfEpgH8gwMxIYIL4QPmTOMCXsFxq2ZixVQfvsPpcKMF/eJzX/uSwKMosbHQA Vqi7PNEfx8fYyi3VpifNeI5dxd+AlLH/A3E6Z934ANtyAIRbLKzZypeB8+XkUAN6pHbP ajwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NbCNnMgp; 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 n2si1874661edq.264.2019.10.03.09.27.46; Thu, 03 Oct 2019 09:27:46 -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=NbCNnMgp; 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 S1730176AbfJCQ1o (ORCPT + 27 others); Thu, 3 Oct 2019 12:27:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:59748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387971AbfJCQ1l (ORCPT ); Thu, 3 Oct 2019 12:27:41 -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 1378721783; Thu, 3 Oct 2019 16:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120060; bh=48xQrCMOZWQY0GMUtiT7ORhyY7JKh36Uou8DfkPsZ14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NbCNnMgpoWdONlOZDrrypP2YnBsZQj3QwrdDa3VTaAHHYqHY4jLMOhE64J9w16nrZ ZvP3gVFCevdJwPXNRFiuhyzS/4VlvCDLL6JgK4QzyJ1F3NzC7wosgrBp3VRZUqP0TU PE+CIHpo185Rty7RjyioCcPSTxn5kWu1g6bcPTT0= 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.2 044/313] media: dib0700: fix link error for dibx000_i2c_set_speed Date: Thu, 3 Oct 2019 17:50:22 +0200 Message-Id: <20191003154537.516567442@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@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 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;