From patchwork Mon Nov 26 13:06:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10698307 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 0443515A8 for ; Mon, 26 Nov 2018 13:07:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8B5C2976B for ; Mon, 26 Nov 2018 13:07:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCCDC2979C; Mon, 26 Nov 2018 13:07:45 +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 6ED572976B for ; Mon, 26 Nov 2018 13:07:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726656AbeK0ABt (ORCPT ); Mon, 26 Nov 2018 19:01:49 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15606 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726468AbeK0ABt (ORCPT ); Mon, 26 Nov 2018 19:01:49 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 907DC492BB05; Mon, 26 Nov 2018 21:07:29 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 21:07:24 +0800 From: YueHaibing To: , , CC: , , , YueHaibing Subject: [PATCH -next] platform/x86: intel-ips: fix 'passing zero to ERR_PTR()' warning Date: Mon, 26 Nov 2018 21:06:46 +0800 Message-ID: <20181126130646.22568-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 ERR_PTR. Fixes: aa7ffc01d254 ("x86 platform driver: intelligent power sharing driver") Signed-off-by: YueHaibing --- 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; } }