Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp917889pxb; Wed, 6 Apr 2022 04:14:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3GvIZxQrZIrgUQn9zFzN/YxSIwRoR0i5QKcFoy0Ek1mM5Grgoo+eeWdUDpqFxvGJ7vrMp X-Received: by 2002:a17:903:1ca:b0:156:b766:7d1b with SMTP id e10-20020a17090301ca00b00156b7667d1bmr8305173plh.0.1649243673903; Wed, 06 Apr 2022 04:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649243673; cv=none; d=google.com; s=arc-20160816; b=zNWANF92IS54PqEbMU4oOCfsuEvc06AlWPkuB6cnu6oz2UPwFgYd4vZDGINcN4hof/ urGB469X1HhsdW1c4ogV4qRhwJ/Ft3VfJZwuc8VlVo7lmktBmsfWHAnl7bLur3qYNYDb ZHvwhWvue1Z5txFh8IEXafT8vtELDxiX+XaN9xaNMCf1O/ltfJIJpLSiM5h2a7R6zKUr Fgy2O2m+YchvHahSi1845OUHDU6/IAIApDmx3trMiNobypSoh7Vm7YfeBTODi2+TCTcT TJevGf62igTXj6FukVImDqFp10314ckPZgJvIPrLnkrSZFL5nUrlzde/D15SHMUZU+0u lRCQ== 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=3TARUuvQc7dm0pAqDYRqzQwe2tUbly3hoZ0lgklokHk=; b=JtXF3QzOvyL89xnnxq3abemVQE1Y4W2mL3pfdi/u4eOpcopXxj0vG/gyoI1eRzh/aL RHGeUPtwhqDLINbrWUED9ZN+RRLgo7mk3sq+jhNQ8jN+D5/EVojkA/JnFIFojWhXA1wC y+Ag1wNZAUai82RyHzImvLDvTS3u/uqvSWZlvJxP4oa379Hurf/lCudnHn1dkWcCvNqd vBBlzgCfn/z0Q0U1Bcaqqq3/bsjEorQdndCrtwX4+C2X67gq5smqwT0GlSCnA/SD+Tfi 7/qjBdCFZx/ZvIeBMyJTWSMYMkiL1Bv61enA06/I1IpdxCvEvdw6yNcOLGSOjWKS1EG/ c1uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0EIEr5/n"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id n10-20020a1709026a8a00b00153b2d16641si14209739plk.585.2022.04.06.04.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:14:33 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0EIEr5/n"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 CE8E74A0BB2; Wed, 6 Apr 2022 02:39:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1454867AbiDEWjg (ORCPT + 99 others); Tue, 5 Apr 2022 18:39:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349447AbiDEJtx (ORCPT ); Tue, 5 Apr 2022 05:49:53 -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 D516527B07; Tue, 5 Apr 2022 02:46:09 -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 8EC97B817D3; Tue, 5 Apr 2022 09:46:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5D96C385A1; Tue, 5 Apr 2022 09:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151967; bh=G9FVdtdJd+SQe71GKHlVvftx16eoviFsChCzeAQD3Wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0EIEr5/nU/fRdMDJSq8ZdLhq7fcceVmjerhEFTTzjZj1HZ71Rg2h7hiQBUT1Qw4p5 3Xiyqt8z8R8ORoO2o5tGdaeyrMlWgqHzUwWtLUuCg/f/C7u9icKHkCcMBwH+7yZfFH kXD4xFo9G5Up6jDnqNXvrfuNArcbynnFD99wLOto= 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.15 605/913] habanalabs: Add check for pci_enable_device Date: Tue, 5 Apr 2022 09:27:47 +0200 Message-Id: <20220405070357.976671039@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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 985f1f3dbd20..0b46fd22c411 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