Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2722976imj; Mon, 11 Feb 2019 07:31:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IYyDJ4RurBKXuMicQK6SfdrfgUvMo/mo5EIPVZ1hPamMUpiIRA/0Ep3kJJaP/LVrWjMWWgO X-Received: by 2002:a62:43c5:: with SMTP id l66mr37489734pfi.207.1549899093795; Mon, 11 Feb 2019 07:31:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899093; cv=none; d=google.com; s=arc-20160816; b=vWpmgDI+hEyEFG6QHhwK6Rio+lzbmWwTBO7Azebxz/vbt2MleqKL3ivPqVndZ0OdXL LYVBEAdKegrYTsc1rIOYMo6OCpCNa6S55dKWnSCdpekJz0+hJtCUpIqIkrKSf1K6ROtO 9j+kgOLBDdPzOTvQ7WEOwQ2qzk4nrX4YpXSyVVu9EBo+DOgx1T57YraG+mlgzxGlYxUK Y+05RvpfIRU3gIkoX/EAXkgA2i+D++cM8uX4+TjZOeYV4luVrDtzMq52VU0XhRTxyS8Q 5Bhs409jCeCLd5TpJHJSRSmC98AyyRl8IpzhcUpyip5n2Rt4JcGv3wONQeTl48FNISDe dZsg== 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=EwKxI0p4xPJmb3Of4u1WEbmiEGGSkQ9hxr65QRKcauw=; b=SY0dDXjLbpR2myZfWm7wsUeC3zJQzc5zOiQ6vOuDwRZHW1dEr7U4ummdpOwKLSm9OV jRPte/Y4iiR+pilkixiKPnQxugj6Qv0dFr9VLE+YA6KMaXK5/ZckcUfmqm7jmjO52BGy HaihgrV6nM42/gCPT0xOCNU3xMmjlny8XQzSoNLw8bTPKgf1PvCe4d3ZxhkBoRELFAeI 2g7s4+Urnya3FznyOdS862r0zNhu14hnxlXPMLwjpXi1UPpZXL1+UYc0XiL2SWV2EQbS sPPYlMfSQTNFkM00YuA8796id9zMCUWHmALFjDJn8X8pFh4fYjpoyyxOeocjyh/HTwqa N4fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K9rXbF6R; 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 q6si2912588pgq.442.2019.02.11.07.31.16; Mon, 11 Feb 2019 07:31:33 -0800 (PST) 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=K9rXbF6R; 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 S2388538AbfBKO41 (ORCPT + 99 others); Mon, 11 Feb 2019 09:56:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:43622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389168AbfBKO4Y (ORCPT ); Mon, 11 Feb 2019 09:56:24 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 52AB2222A1; Mon, 11 Feb 2019 14:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896983; bh=CSNv0dqPJnCfXK8VtJrYT0xdpPluNUhwpHDzhQnQ7TA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9rXbF6Rd1CSYwR/F5RRKogicnUBktaqrVximUH5eVpmqtexgNb3nRRxYSpvJW4Uc RmZYBwURt981XjLm9jpTivYxMRQqKQnzds4iGB3+FSDh+zAETjQ0tUG1uSaD8vYdmQ lSwRo2k7u4SG9GWFcKRnl2DWmrh1M6XgOhdT1WB0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Puhm , Anatolij Gustschin , Moritz Fischer , Alan Tull , Sasha Levin Subject: [PATCH 4.14 022/205] fpga: altera-cvp: Fix registration for CvP incapable devices Date: Mon, 11 Feb 2019 15:17:00 +0100 Message-Id: <20190211141828.576397110@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 68f60538daa4bc3da5d0764d46f391916fba20fd ] The probe function needs to verify the CvP enable bit in order to properly determine if FPGA Manager functionality can be safely enabled. Fixes: 34d1dc17ce97 ("fpga manager: Add Altera CvP driver") Signed-off-by: Andreas Puhm Signed-off-by: Anatolij Gustschin Reviewed-by: Moritz Fischer Acked-by: Alan Tull Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/fpga/altera-cvp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c index 00e73d28077c..b7558acd1a66 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c @@ -404,6 +404,7 @@ static int altera_cvp_probe(struct pci_dev *pdev, { struct altera_cvp_conf *conf; u16 cmd, val; + u32 regval; int ret; /* @@ -417,6 +418,14 @@ static int altera_cvp_probe(struct pci_dev *pdev, return -ENODEV; } + pci_read_config_dword(pdev, VSE_CVP_STATUS, ®val); + if (!(regval & VSE_CVP_STATUS_CVP_EN)) { + dev_err(&pdev->dev, + "CVP is disabled for this device: CVP_STATUS Reg 0x%x\n", + regval); + return -ENODEV; + } + conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL); if (!conf) return -ENOMEM; -- 2.19.1