Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp695223pxb; Tue, 5 Apr 2022 19:07:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGigEeWnOuG7PY1rgzcsMi8+IDiCPLupebhjNwhNCRufd0IHusCy49yMY89FFVKcmo7RoB X-Received: by 2002:a17:907:216f:b0:6ce:d85f:35cf with SMTP id rl15-20020a170907216f00b006ced85f35cfmr6342421ejb.517.1649210843747; Tue, 05 Apr 2022 19:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210843; cv=none; d=google.com; s=arc-20160816; b=ssXh7smdJODsIzsOItE3LZlsR6lhpd97ilFT4rIC91aL2wm9S5gjvMIVyMwuB+Cdl/ wXq9bDJPpDSZ2CLhMShOnRmO+E6W3q1K1xLrejNJd+FSc+wZeB587lSIY5NjgUPBzNd8 WwLIKffmNXTKM5cteLTnjj2ViHgj/xnxocEFcqQ4JlDZpCjpFcLgtKOc2M1d1Tiy0IPs sKRFycrdEUVS8e3mWVrZ97xy+FMa93tIdcKZxbsKgL8cEwdbeBqUfYA9/YrfIY3NxKRn LA3Znn6VkKGUsHqh52LJhgGy0yV+8Hj6/pqRtk9gqtlFuwTWkkumAmiHFdY/okTHZBI4 JH0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HxtKcHT/xHx5wgKtxoEGau6xknAg8AhuyCWhw/UZZPw=; b=Q19as1h6AUhv+I9Qa43Q0MhvGD17aBpIxhmVePObgCFRBkEYNDljjRfMwjTgJsDabg fDTOoqNPj3A11KFXiu84PeRdV3V/6ml5/7RFSMVVmtl/FtguMyntFUK2uDSTBdXM4vFi bNlkdhu4yGvkOx9qXs33kiG2qyGfGnBXINZPjk83y8V3TF/tN25ITp+lGm2p1ElKlfOk BQ7L9Z8gQ0lLWlNW9UFnWn6KLDu6ia/c0YKQy95wl7UuHFztS8UPDlyM30OX3GJ6uUFV mtEDZaB3U8jaSTzFjo/sfJHnYfcReUpghNKg+Eg8wTDgXN5a0OsqJ4ePJXI4ZpT+fKQZ vPGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sLWkBkHR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e26-20020a170906375a00b006e7ee854ec4si6757035ejc.715.2022.04.05.19.06.58; Tue, 05 Apr 2022 19:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sLWkBkHR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358244AbiDENJI (ORCPT + 99 others); Tue, 5 Apr 2022 09:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344110AbiDEJSO (ORCPT ); Tue, 5 Apr 2022 05:18:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B5E37A38; Tue, 5 Apr 2022 02:04:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55791B81B75; Tue, 5 Apr 2022 09:04:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B128FC385A0; Tue, 5 Apr 2022 09:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149448; bh=wCS0KzKr4oLP5q/Kgg4TSGoEWXx2RJU1a3UmIAGtzOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sLWkBkHRkM+s9P/VbqidAGoB6i1ZKF+StVZfOP5p3E3F/Yvw9aOUK6QXSfJaTSMh4 fjvdPIDK28ESIfzNDOx+TJn4PFuYoRyPQbtxdea68hgz+hMceS2QAFCgCsFtw8mA/C jeJKIahB4Gde1PSk316XzKMkWYncSX3678wWoZn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Oded Gabbay , Sasha Levin Subject: [PATCH 5.16 0670/1017] habanalabs: Add check for pci_enable_device Date: Tue, 5 Apr 2022 09:26:23 +0200 Message-Id: <20220405070414.169016092@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiasheng Jiang [ Upstream commit 9c27896ac1bb83ea5c461ce6f7089d02102a2b21 ] As the potential failure of the pci_enable_device(), it should be better to check the return value and return error if fails. Fixes: 70b2f993ea4a ("habanalabs: create common folder") Signed-off-by: Jiasheng Jiang Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/misc/habanalabs/common/debugfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/habanalabs/common/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c index 1f2a3dc6c4e2..78a6789ef7cc 100644 --- a/drivers/misc/habanalabs/common/debugfs.c +++ b/drivers/misc/habanalabs/common/debugfs.c @@ -856,6 +856,8 @@ static ssize_t hl_set_power_state(struct file *f, const char __user *buf, pci_set_power_state(hdev->pdev, PCI_D0); pci_restore_state(hdev->pdev); rc = pci_enable_device(hdev->pdev); + if (rc < 0) + return rc; } else if (value == 2) { pci_save_state(hdev->pdev); pci_disable_device(hdev->pdev); -- 2.34.1