Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp723023pxb; Tue, 5 Apr 2022 20:22:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Vl4ZIEixy+XbXgTgznHLWqQLmizcNoqDcLcPsbkLYSD+gUGFfqrCAo0zgDP75zw+JSty X-Received: by 2002:a63:6bc9:0:b0:386:2e2b:41a2 with SMTP id g192-20020a636bc9000000b003862e2b41a2mr5449120pgc.444.1649215372921; Tue, 05 Apr 2022 20:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649215372; cv=none; d=google.com; s=arc-20160816; b=DcP6/aG5KRkmZ2ZN6YRRNJvlUGszpPa+2G+R+0ImFaDnbkyYHmdMorQfACN+DmJo/v uGCsV2QISq6tPibT9ZeJO9I0tQEpNHqvrN2UGU1oo7nGzUavXwIuabXZicu950dE47JI H0QVFfbyt+uMLU4802kR9NBxT06CO0rhEcEcCsB3hs6Vf8d4WghysowqzKnYvroVtrS6 2MACjwEoi4s4XSCcpbIiwRHYZi3evJZkI3Q3Anw+nDmg7UIRNsYxBMpOEKyZA+AtrXy5 01RDBIaxNfd8WEohaW7w65AG2lUQPMh9bfJkWVxoRlWscuaDXrA05ZeVJq9o71ZtcCnF 72+Q== 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=pdSfukhi/fgXXkLsR6tU9lQr5A5tYXOzVpLYMx1sex4=; b=f5Hu63SdxIvqsQHlHD//ZjVd8st9ZBhMDJDAQsq0qUrelDu4bkHmvGsnh8oqn7zAlw esHp46ksb9QU1eTR7g+FEhxT+mM1Re3DywU+FwP0NNT2Ziaqi9WvpDnuZRj76jHu6XGG kkhW2TWStiWTRwtSvte53qm5mDkOwBpucjbx7fueIMjwKd4eQWJBxTcW45We9Ts8hovK 9NMgG5zPKzWpYMcvCQMz+yz8JR5mykO8+ydM/o3YEFdNK+XDRFkCVRk111ToSY1csA7e dPswm2zvwqc/BcDpH+3dlhqA4vwB+MdeeS/usiaQiHjf2hPsQRIemAdJBbyA9zOS7L9R Du/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IFin/vo9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 1-20020a17090a004100b001caf0adf692si157106pjb.189.2022.04.05.20.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 20:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IFin/vo9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2892730CB9F; Tue, 5 Apr 2022 19:55:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243112AbiDEJIq (ORCPT + 99 others); Tue, 5 Apr 2022 05:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239413AbiDEIUD (ORCPT ); Tue, 5 Apr 2022 04:20:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2495A6E376; Tue, 5 Apr 2022 01:12:50 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B3DCE609D0; Tue, 5 Apr 2022 08:12:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A5CC385A1; Tue, 5 Apr 2022 08:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649146369; bh=LJJehfXe2pxzDjwyzAOhqxPzhzKLcJEjYz+g1v9YVeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFin/vo9uwu+WTKIxeav1bEbfXJjS+GFiHjB0AXItubJSt/KX2ooaZenYGYfO+UPE CnW8dLRK+9+/LHMttzOHH4KnzfHdZ9NLZGGjOPkdBc0BENGdM3jVjpEJOAW1xEwjFd V887ybRtkS26mjM5ojloLON2bBYgxUbCQdGdrb0A= 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.17 0739/1126] habanalabs: Add check for pci_enable_device Date: Tue, 5 Apr 2022 09:24:46 +0200 Message-Id: <20220405070429.278835914@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 fc084ee5106e..09001fd9db85 100644 --- a/drivers/misc/habanalabs/common/debugfs.c +++ b/drivers/misc/habanalabs/common/debugfs.c @@ -890,6 +890,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