Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1745748pxm; Sun, 27 Feb 2022 01:44:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHWuAc3tC64wdDqhwzTJKR5VOnMVuvqKTtY2UqVbiTUyQWG4g/Q1i+9hdkMZNPlvIQjReq X-Received: by 2002:a17:90a:bc89:b0:1bd:33ac:d293 with SMTP id x9-20020a17090abc8900b001bd33acd293mr2728767pjr.51.1645955071110; Sun, 27 Feb 2022 01:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645955071; cv=none; d=google.com; s=arc-20160816; b=DXoDTkWi0b0gmF/d4z+9pOwaMl2YbbR9LOozWlLXwO2Mu45fPyZWZspPy8CbHvw08y 4Z7s5XJyQPKZC4AL25wcxQXHyk6tSg5oY+lMwGJmd5428YBrLpQCKafiOFMyMyzecvVK 14qkBY+cXmhEHqRTDd3ZYTqOQvM35Im4ETjkDrIAnggcEroRvygaUwnN51Tx7u+XfwwG hGuvPgaJFwHwiqj8v/RNkm4ByngpASz4JUbvnrvyO3nRb25MxFDnDqfvMfs7PpNqEZjf OE6MCTVMUjk3xrePv0sqPUH+sitcW3OVJsEsGSpxs16enFtzVx+SWPmGJTlEu0ZXqkQ0 8wpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yf0NpsXLDkj8TcTITdFTYrzZO3BglvxqFqwWfwPLRR0=; b=ecVlADxhDFTtjOcJ22k9PBSSBuZV2q/mKUNPq1f7NUjZGNZO7iW395M/loKLJfU1qJ F28bvNt6lghycHmbYrp8CclIRnXupg5oQroR2wBxorGVewIKtABdsEQuXZBUAboGpl0c sDosHJKgPRICR8GlmIlaX4WAGpwCsIVtuh53CHtGbR5/IsfevPV57RUfGCLSzo6sqLF2 X9sv3pJKNqntY2pEJkFwFXhBRsxfT6YVezEGzz+RzyIUU9Z37B03Co30FzChnnV6F17Q 6TiXR/h1PrMK5HurbnYQzmhCtatFF/7pdKgVnpSosWLGPSaH7+6EuyXzQSpJa5H2AG+d VlNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gT7GD5td; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a170902d50400b0014fdb108a6esi6402834plg.61.2022.02.27.01.44.17; Sun, 27 Feb 2022 01:44:31 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gT7GD5td; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbiB0Jmq (ORCPT + 99 others); Sun, 27 Feb 2022 04:42:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbiB0Jmn (ORCPT ); Sun, 27 Feb 2022 04:42:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 387454130C for ; Sun, 27 Feb 2022 01:42:05 -0800 (PST) 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 C3FBA60BB9 for ; Sun, 27 Feb 2022 09:42:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 224CCC340EF for ; Sun, 27 Feb 2022 09:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645954924; bh=uj1Pj/eliIRdIKDBsXyzCsYCI51mSIr4KYzn8O17m6g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gT7GD5tdAFX5pb4EbgCAnXXkqjAiMnHnINCyb85q+pK60XuTEsL6+Nn+1YtdnBhik PVwCbT20R/kHw7blds44jL1g4dpzQwBUvv45QgnvRGoa9DtEU3f5UaaQPaQdNFm0Qi sHRPqYaHUyUZd4MKk0hlqjkbC1w5MevGV6UZTXMI8bHNsSpVk3cYq2xFz/MCsCPhoE CQhlrPzSADZ0f7T35Hbisdcmn6m9MtG5Cmz7PqxIVKxeS1ExnND735GBN6mYNln5hB BkrIjd3Ia902S5hxdZMJ10wa3W5mjcPtNYPbeVL4Ngc7JH9Y3gpNJ1uR5D/BHQ6Rqn zvCTmfhTPi9zQ== Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-2d66f95f1d1so77934647b3.0 for ; Sun, 27 Feb 2022 01:42:04 -0800 (PST) X-Gm-Message-State: AOAM531Spha7ttcF7Gs6PqqJHWa9K3Bcb/nH3xQIjsI54LnetbL/kEmE WFk+sXfHUFoS//q3sknLIZspROt+m0gc6H48FQ8= X-Received: by 2002:a81:301:0:b0:2d7:3774:a50b with SMTP id 1-20020a810301000000b002d73774a50bmr15677827ywd.206.1645954923209; Sun, 27 Feb 2022 01:42:03 -0800 (PST) MIME-Version: 1.0 References: <20220224065805.3305407-1-jiasheng@iscas.ac.cn> In-Reply-To: <20220224065805.3305407-1-jiasheng@iscas.ac.cn> From: Oded Gabbay Date: Sun, 27 Feb 2022 11:41:36 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] habanalabs: Add check for pci_enable_device To: Jiasheng Jiang Cc: Arnd Bergmann , Greg Kroah-Hartman , Yuri Nudelman , Ofir Bitton , "Linux-Kernel@Vger. Kernel. Org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.5 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 On Thu, Feb 24, 2022 at 8:58 AM Jiasheng Jiang wrote: > > 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 > This patch is: Reviewed-by: Oded Gabbay Applied to -next. Thanks, Oded