Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3710726imu; Mon, 28 Jan 2019 09:26:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN65djBOTr8gehTrJwwWPZSbWj3/dKbDjlIcDxItZmJeL4IP3sXkAxwEIsYxhEpbxwPvLo0M X-Received: by 2002:a63:88c7:: with SMTP id l190mr20215609pgd.110.1548696374040; Mon, 28 Jan 2019 09:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696374; cv=none; d=google.com; s=arc-20160816; b=SSb4xu+ro8pie4CK+3TYa+vDUyJN3+Gmg0IqHFQYfuj1vxaghGGJFrdUe0fq+vgj1T nEpZ0ZAJ0kA3UKtwi1LFJaap0Rn0elf02Hv1yfbyz8QDGjSJAzoPiyUEaq+zlmMtK+ps U6bP4dxAb1aVUy+0yJsPT6iOI38vOrQCRkY6qgQOcZCWmEWCAnJu0R+lhYP+rtIqjGyz Xk5PzWIZFHnR+7gBN+5/Ze2LgkZv1gtgVY6Re2lYVcxD0I7R8GqiXrEJnkV6AijUgvNx WnToU/JHCZHQWehbiNjaLeyArZNYhIQJ3EtDWPQoS5NIGYlWwGXGtdT7sPjhIZOXavfa 1w0Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FBx04fue5eJem8avvSGa29pz1UhLh1H1XecyrauU9CI=; b=tvY19vfBpDjYR5adI4W9EESTRKIA7TiHQQwHveTmugRPoQ3QJ0bD7C5m+sI2B7ke+e iXamYqZOx3hrpdAjx9duJvneqPVLp2TvMsNX6yzD22YrZqkI1aQL7Uk3N/XpNrjlGUBD WeFXzYskzq2CfB3p7bE7PQDgOon/m2TQeo2iSqr9plRYhV9rT/lfpMqkRpzJ6bUmmVQf o54JlhMI2OIdW+8/hM0g/RU4jtSGGtwn2GEL2o2OI6uq/H4FjuBAG62m5sN1si4Wo/vT GfMObjzGD90RvTx+o3nVkNv/751eb2eSErtFj5uXRMb8Wq6rMyo5v809QUH776yCyF0o B7ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LGZc7OzS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si13035564pln.55.2019.01.28.09.25.59; Mon, 28 Jan 2019 09:26:14 -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=LGZc7OzS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730947AbfA1QBH (ORCPT + 99 others); Mon, 28 Jan 2019 11:01:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:46388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730934AbfA1QBE (ORCPT ); Mon, 28 Jan 2019 11:01:04 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C47F621848; Mon, 28 Jan 2019 16:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691264; bh=1F3vRrCvGAESOT0vAId8P2CWXZVjaujS26Y2YQ8/qmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LGZc7OzSIBr/SSB2zXLmjBU9gp0ny1q/V8Vhw+WIDxfwMM+CZ3frV51Hl6tLVX2wu cyATppXRPPKxqu8ti47j7BXqSJYF1MPISlrmMLEue5H7ZmFdR8lJG2n8ana3faPvIf DTt9Ig9qiFsYSUoBvuq+SmaHNVLkF1OU7FHLb0zM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andreas Puhm , Anatolij Gustschin , Greg Kroah-Hartman , Sasha Levin , linux-fpga@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 037/258] fpga: altera-cvp: Fix registration for CvP incapable devices Date: Mon, 28 Jan 2019 10:55:43 -0500 Message-Id: <20190128155924.51521-37-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andreas Puhm [ 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 68e4b2b98c8f..1f4c26b4794a 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