Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1321613pxm; Thu, 24 Feb 2022 00:22:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3VW9d+bc75gMzXhEV1cNtUaHDQaqV+g/RR3ofDo4WqV78kbkmN7nYYiqXVSRbaJzotz0x X-Received: by 2002:a17:907:2711:b0:6cf:350:81c3 with SMTP id w17-20020a170907271100b006cf035081c3mr1368897ejk.712.1645690934219; Thu, 24 Feb 2022 00:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645690934; cv=none; d=google.com; s=arc-20160816; b=Uh59Dete7ZoD3MyMOF3lj20yYgBrvsF8j/Zg+PcB5q2wPTM36MDcPRjUOAZARr+S5a +Az3BXVSgOayr3wU/WLFLOKHm9Q0b9G30bXhkGwXQUeedlOUjSc5JFo9H38VylASJDq6 3DVrFij7+lFoZKMFiChwQSAgu4+jZ02FaxJ0t/hcKwBtDsXHwHVempeQV/wnnshz6Cp6 +1q+VvqEI1qnMXvOIx0/vH59xVeRXaAEnomCLoG4XrDxrpFLHkMmbXK4VJMZue4KaRi/ CtUVUHJNR4i01sgr2dBVGuh5X+Yd67Psw7KCTeXtJ2MNcRTPXvj0ETAZmVkrM6tRWkH+ eQkw== 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 :message-id:date:subject:cc:to:from; bh=nX1rPqkf8ZFR/SOfDLoSIJKPl0CA+kbTUpPewurFrGQ=; b=A11G59mxUzGIw9Mj8QKxndePd817Jf5euHRx5cGJ1fMvV4NyoLT/yxiDOwxV9jMFzc 3SOpNz2/4z5Ka2Gqul1R5JeSpnG/U4roG0aC3J/h+ECKJirvJr/TbWSMfSvU6f/f6QYS E98ndWwSQZccdvXZBOFVo4kjBPKk1Tvb0V6sTVxSyqQTnXpsegdbqDFHe6eXCpyRRm4U VZP0pXta1AjqDlIqh0hd0XdhPyYSNiI2A7VqiuhGSm+AFj9MP9M6/7QfU+pK0qzADET3 sPqOxunF1Z4fHhhENdCOlJn8TKZ79NF/kDY7B7FPzumaeimVH7tAYJ1lSWv7r5der1EZ K/4w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o26si1093171eju.813.2022.02.24.00.21.50; Thu, 24 Feb 2022 00:22:13 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231430AbiBXG6z (ORCPT + 99 others); Thu, 24 Feb 2022 01:58:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231422AbiBXG6r (ORCPT ); Thu, 24 Feb 2022 01:58:47 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 09D681BB71D for ; Wed, 23 Feb 2022 22:58:17 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-03 (Coremail) with SMTP id rQCowAD3_8N_LBdiOdUcAQ--.9684S2; Thu, 24 Feb 2022 14:58:08 +0800 (CST) From: Jiasheng Jiang To: ogabbay@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org, ynudelman@habana.ai, obitton@habana.ai Cc: linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] habanalabs: Add check for pci_enable_device Date: Thu, 24 Feb 2022 14:58:05 +0800 Message-Id: <20220224065805.3305407-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowAD3_8N_LBdiOdUcAQ--.9684S2 X-Coremail-Antispam: 1UD129KBjvdXoWrZF4DZw15uF45CryxXw1rtFb_yoWftFc_Ka y8ZrW7XrWUJwnayFnFkry3Z3y8KayDXr18ZF1Iq39aqryFva97XrW0vrn5Wr43urs0kw17 Gr9rX34Skr40kjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbckFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8AwCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU-J5rUUUUU= X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,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 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 --- 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.25.1