Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2648351imj; Mon, 11 Feb 2019 06:26:47 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia2afSXdrE3+OZDVQmOaL4GZNI6PZlACqfkMFRrcKThLpoyvjkUXAjoXp5EJTIX/D0C8gzq X-Received: by 2002:a62:6e07:: with SMTP id j7mr37864037pfc.135.1549895207713; Mon, 11 Feb 2019 06:26:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895207; cv=none; d=google.com; s=arc-20160816; b=bjU7G/TAQX+knkfJ0EIRI1VRfMFcS/GoWwtW3Fp8QfUtE1lgJojpWbjNvZn5fm91ln mMN3YFnVh1iy0vYo2M7VuYs8DGFI90Y66A1PTLkKsgXlapiKrQZuwO6UDi2cBfjMcKWc l9ACetC0G10ObRiqRVhR1jZWNZeu0XyCqSygj3d1d0igLwM2vRIBtgJUsA6h0cbg1mPE 4rBe/3E+yIEh5xcWfiYPg3oCe++k9JMgw703Q7G+J7UQvjLyFaGE6D20LGR5VImeO4lm 8jy9Uf1zEtQYN0/SLEFe7dim7jzORMD7qBaVC7pDAVdH1XjoehcaMiY59JjluNj70tzq AZcQ== 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=YzlY/5DnuF0KhpMTT/OnJnbQsiQqtaiCNTpwgBiZy5A=; b=QQ1fzdOC3IWLUDuTnWoc1veR0P70o7OEYnaudu2RRxMDziNCoamh9HkwwlBUAMf3f6 TiWvOfsvW5GMFaBz5JqYFwsfCa2DVMzXEIJ0BPh6ZPCzzQxfenEE7903FLKLhFQj175V hnDri3nevFBYw6oaSb3uWciAmvYiIlObb4gw0sA4laIYg+2WhS6s+mP0gXJCxAMAw+XP H4dU2CPYBn03HaoA8fMiEnXKIoP7Uw5QVs69mbYWrMCpm8lYfFQ9GvGKu7oGjB2/KCUD NBvr6HaAc72sULhE4qkUoDLiK1SQvf6wO6p3hROT8bJLiBJoECIxV8qC3IMh0GvWG42y n5vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DpQ9guMq; 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 v3si1959485pgr.191.2019.02.11.06.26.31; Mon, 11 Feb 2019 06:26:47 -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=DpQ9guMq; 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 S1728732AbfBKOWV (ORCPT + 99 others); Mon, 11 Feb 2019 09:22:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:55220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727551AbfBKOWT (ORCPT ); Mon, 11 Feb 2019 09:22:19 -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 27CDD20844; Mon, 11 Feb 2019 14:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894938; bh=mAJ/IvRiAJggwhNBnNaEg/MW3gSIo/3rigsp4pevsY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DpQ9guMq45LJ5roBSNaaOcIHkEk7JjmTzuJLSUJszUGBQsWZavlB7MfJ1XyunHdIU zv85heFsFhvNsVjJe1bhPWWbzu6+Wmna7YErMljkkxaAXITsfZRazPK8U61QG7qWyr t18SreYgxN2vuTWbTOcJggVBmCNWt1wAg8obg6oc= 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.20 037/352] fpga: altera-cvp: Fix registration for CvP incapable devices Date: Mon, 11 Feb 2019 15:14:24 +0100 Message-Id: <20190211141848.684081319@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 d9fa7d4bf11f..36d79b039c57 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c @@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev, struct altera_cvp_conf *conf; struct fpga_manager *mgr; u16 cmd, val; + u32 regval; int ret; /* @@ -416,6 +417,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