From patchwork Mon Nov 26 13:19:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10698365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A4AB17D5 for ; Mon, 26 Nov 2018 13:20:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23FAA2967A for ; Mon, 26 Nov 2018 13:20:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11B992983A; Mon, 26 Nov 2018 13:20:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FFE32967A for ; Mon, 26 Nov 2018 13:20:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726225AbeK0AOO (ORCPT ); Mon, 26 Nov 2018 19:14:14 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:41810 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726176AbeK0AOO (ORCPT ); Mon, 26 Nov 2018 19:14:14 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7F1EA5D5FCFC8; Mon, 26 Nov 2018 21:20:00 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 21:19:51 +0800 From: YueHaibing To: , , CC: , , , YueHaibing Subject: [PATCH v2 -next] platform/x86: intel-ips: fix 'passing zero to PTR_ERR()' warning Date: Mon, 26 Nov 2018 21:19:48 +0800 Message-ID: <20181126131948.18160-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix a static code checker warning: drivers/platform/x86/intel_ips.c:1314 ips_debugfs_init() warn: passing zero to 'PTR_ERR' drivers/platform/x86/intel_ips.c:1328 ips_debugfs_init() warn: passing zero to 'PTR_ERR' If error occurs,debugfs_create_dir/debugfs_create_file return NULL while debugfs is enabled, which should not passing to PTR_ERR. Fixes: aa7ffc01d254 ("x86 platform driver: intelligent power sharing driver") Signed-off-by: YueHaibing --- v2:Fix typo in patch log and title --- drivers/platform/x86/intel_ips.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index 225638a..a5d1a68 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c @@ -1311,8 +1311,7 @@ static void ips_debugfs_init(struct ips_driver *ips) ips->debug_root = debugfs_create_dir("ips", NULL); if (!ips->debug_root) { - dev_err(ips->dev, "failed to create debugfs entries: %ld\n", - PTR_ERR(ips->debug_root)); + dev_err(ips->dev, "failed to create debugfs entries\n") return; } @@ -1325,8 +1324,7 @@ static void ips_debugfs_init(struct ips_driver *ips) ips->debug_root, node, &ips_debugfs_ops); if (!ent) { - dev_err(ips->dev, "failed to create debug file: %ld\n", - PTR_ERR(ent)); + dev_err(ips->dev, "failed to create debug file\n"); goto err_cleanup; } }