Message ID | 20221125092415.29635-1-zhengyongjun3@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3879462wrr; Fri, 25 Nov 2022 01:27:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf7K7JDzOQClgRldQy5N2opwxEtRsiHu9EH99QTyn/nv47dxqZ1PBtg8i7cWEH4pGm3YNok+ X-Received: by 2002:a17:902:f68a:b0:188:4ea8:a685 with SMTP id l10-20020a170902f68a00b001884ea8a685mr17492887plg.71.1669368476120; Fri, 25 Nov 2022 01:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669368476; cv=none; d=google.com; s=arc-20160816; b=OX5VVH7R1HeuQ/WkUrYVMtlwTJm6rfhnMmPpynM5dRpG4wjMx0FilKzT7Wqhj1Kg6R AnV6jTwrE5bfPe6CQSfqsPa4+DJY/4ob2lbu1NmRSoyTTxYgYwIxwoTwQs2VW4WP8s1N wnc3d+XUHV/I2vJhCc6+RkZKZ43gvp2zqsEqYEHrU9sXipBj4epGlzgTzCHDcDkzRY5r CbMHiE8t54ErA4OMDJf4DKQSgXWfwGbXPsd+0XqsAGf1sQEH+wiWN0YvZByDBJVmdCTY Mfuf9qPBro+bc8kWyWAFH6qXMFQSqZu5Xng8QeqvqUbC/TXcMhRvfdfsg+m01feIQMWF BK7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=UP7fUU27eErGfbdIXJHLHR4Fjn4kOmJqF8I6XdKIQx4=; b=H6jzbQtYqjEOdKgCvVN961Ha6K3fqoAortF2mNhDPruti2Q0v6fENtTuwUv8hTl+Sv 98wmpOThjFel2Sv0xNTWr9d2cIApC/q32BztEnDB2UI+wwubMf2HronxlYEQwn/KgoYA 78g5GuOPjMFbvsAFwDme8U5PPPnvBPmXLsTgduBL8xvwDpvZHxlXUB9CRv7GeTEpihjt CVsHdBxNysQC82l4aeO5MuBtDslEqjZQl4ewRmOIVte+us5Cv19VINtyN4pycZcX190T gg94io1TostjU5NtDsO4AuSfwMvG/DEnLiCWGsmefjq8mTV5y+95d8GUwumvxcvBEIzR i3Vg== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp8-20020a056a00348800b005745eb6c2e1si3023327pfb.182.2022.11.25.01.27.43; Fri, 25 Nov 2022 01:27:56 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbiKYJ0x (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Fri, 25 Nov 2022 04:26:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbiKYJ02 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 25 Nov 2022 04:26:28 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 708F9326F1; Fri, 25 Nov 2022 01:26:21 -0800 (PST) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NJTxQ1ltpz15Mv1; Fri, 25 Nov 2022 17:25:46 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 17:26:18 +0800 From: Zheng Yongjun <zhengyongjun3@huawei.com> To: <eajames@linux.ibm.com>, <mchehab@kernel.org>, <linux-media@vger.kernel.org>, <openbmc@lists.ozlabs.org>, <linux-arm-kernel@lists.infradead.org>, <linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org> CC: <joel@jms.id.au>, <andrew@aj.id.au> Subject: [PATCH] media: aspeed: Fix return value check in aspeed_video_debugfs_create() Date: Fri, 25 Nov 2022 09:24:15 +0000 Message-ID: <20221125092415.29635-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750459719130622108?= X-GMAIL-MSGID: =?utf-8?q?1750459719130622108?= |
Series |
media: aspeed: Fix return value check in aspeed_video_debugfs_create()
|
|
Commit Message
Zheng Yongjun
Nov. 25, 2022, 9:24 a.m. UTC
In case of error, the function debugfs_create_file() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().
Fixes: 52fed10ad756 ("media: aspeed: add debugfs")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/media/platform/aspeed/aspeed-video.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--
2.17.1
Comments
Hi Zheng, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on media-tree/master] [also build test WARNING on linus/master sailus-media-tree/streams v6.1-rc6] [cannot apply to next-20221125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Zheng-Yongjun/media-aspeed-Fix-return-value-check-in-aspeed_video_debugfs_create/20221125-173242 base: git://linuxtv.org/media_tree.git master patch link: https://lore.kernel.org/r/20221125092415.29635-1-zhengyongjun3%40huawei.com patch subject: [PATCH] media: aspeed: Fix return value check in aspeed_video_debugfs_create() config: m68k-allyesconfig compiler: m68k-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/6ef6de2d58d68d417a12877da05936440470b22e git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Zheng-Yongjun/media-aspeed-Fix-return-value-check-in-aspeed_video_debugfs_create/20221125-173242 git checkout 6ef6de2d58d68d417a12877da05936440470b22e # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/media/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/media/platform/aspeed/aspeed-video.c: In function 'aspeed_video_debugfs_create': >> drivers/media/platform/aspeed/aspeed-video.c:1785:32: warning: passing argument 1 of 'ERR_PTR' makes integer from pointer without a cast [-Wint-conversion] 1785 | return ERR_PTR(debugfs_entry); | ^~~~~~~~~~~~~ | | | struct dentry * In file included from include/linux/container_of.h:6, from include/linux/list.h:5, from include/linux/preempt.h:11, from arch/m68k/include/asm/irqflags.h:6, from include/linux/irqflags.h:16, from arch/m68k/include/asm/atomic.h:6, from include/linux/atomic.h:7, from drivers/media/platform/aspeed/aspeed-video.c:5: include/linux/err.h:24:48: note: expected 'long int' but argument is of type 'struct dentry *' 24 | static inline void * __must_check ERR_PTR(long error) | ~~~~~^~~~~ >> drivers/media/platform/aspeed/aspeed-video.c:1785:24: warning: returning 'void *' from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion] 1785 | return ERR_PTR(debugfs_entry); | ^~~~~~~~~~~~~~~~~~~~~~ vim +/ERR_PTR +1785 drivers/media/platform/aspeed/aspeed-video.c 1777 1778 static int aspeed_video_debugfs_create(struct aspeed_video *video) 1779 { 1780 debugfs_entry = debugfs_create_file(DEVICE_NAME, 0444, NULL, 1781 video, 1782 &aspeed_video_debugfs_ops); 1783 if (IS_ERR(debugfs_entry)) { 1784 aspeed_video_debugfs_remove(video); > 1785 return ERR_PTR(debugfs_entry); 1786 } 1787 1788 return 0; 1789 } 1790 #else 1791 static void aspeed_video_debugfs_remove(struct aspeed_video *video) { } 1792 static int aspeed_video_debugfs_create(struct aspeed_video *video) 1793 { 1794 return 0; 1795 } 1796 #endif /* CONFIG_DEBUG_FS */ 1797
diff --git a/drivers/media/platform/aspeed/aspeed-video.c b/drivers/media/platform/aspeed/aspeed-video.c index 20f795ccc11b..c8fc2450e409 100644 --- a/drivers/media/platform/aspeed/aspeed-video.c +++ b/drivers/media/platform/aspeed/aspeed-video.c @@ -1780,10 +1780,12 @@ static int aspeed_video_debugfs_create(struct aspeed_video *video) debugfs_entry = debugfs_create_file(DEVICE_NAME, 0444, NULL, video, &aspeed_video_debugfs_ops); - if (!debugfs_entry) + if (IS_ERR(debugfs_entry)) { aspeed_video_debugfs_remove(video); + return ERR_PTR(debugfs_entry); + } - return !debugfs_entry ? -EIO : 0; + return 0; } #else static void aspeed_video_debugfs_remove(struct aspeed_video *video) { }