From patchwork Sat Sep 7 03:43:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 104064 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from ny.mirrors.kernel.org ([147.75.199.223]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1smmEL-0004Uu-09 for patchwork@linuxtv.org; Sat, 07 Sep 2024 03:35:23 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BD1621C21CE9 for ; Sat, 7 Sep 2024 03:35:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11B1139851; Sat, 7 Sep 2024 03:35:15 +0000 (UTC) X-Original-To: linux-media@vger.kernel.org Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECA7B1CAAC for ; Sat, 7 Sep 2024 03:35:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725680114; cv=none; b=Q7B3f11R2HyWW1LIQfavT41hs1p2c4bUk4VVTffpXdhGK90DSVfZ/NK4W7fLUREedpoflGOJdt/j9hYxev0UxtBmzc3eGaryGfFkH+fmyXWncdn2QoRxdRC3RSgc6euy44Q9qKSIQBefNCFYsG+HOrLTr9Kwwh1Lefu1n+s/dT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725680114; c=relaxed/simple; bh=whVQBy4YiYeqaKcukKbd8CbWIZ7/ozer1z+E4DyF2tY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=FZ44DfKZm2P8MFHOaDz0k/zLW/17T/kQIoYT36aB+X06IxSCd2P1aZ4x+qIwTx7TJpHKRTWx4vEJdMKPh9j5kdoU3tqhAxkQ8s8/eeuvrm3RMMustsjjzw/3lXFUXbH+p98Vj3Xm52P3rYNObuAimbIj8Z+19jetyWrYLpgwzjQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4X0zHV6Rnjz1j88w; Sat, 7 Sep 2024 11:34:46 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 844BE14011F; Sat, 7 Sep 2024 11:35:10 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Sat, 7 Sep 2024 11:35:09 +0800 From: Li Zetao To: , , , , , , CC: Subject: [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Date: Sat, 7 Sep 2024 11:43:59 +0800 Message-ID: <20240907034400.3693797-1-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemd500012.china.huawei.com (7.221.188.25) X-LSpam-Score: -5.0 (-----) X-LSpam-Report: No, score=-5.0 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DMARC_QUAR=1.198,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_VALIDITY_CERTIFIED=-3,RCVD_IN_VALIDITY_RPBL=1.31,RCVD_IN_VALIDITY_SAFE=-2,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no Since the debugfs_create_dir() never returns a null pointer, checking the return value for a null pointer is redundant. Remove this check since debugfs_create_file can handle IS_ERR pointers. At the same time, debugfs_create_dir returns ERR_PTR (-ENODEV) by default when CONFIG_DEBUG_FS=N, so there is no need for CONFIG_DEBUG_FS macro isolation. Signed-off-by: Li Zetao --- v1 -> v2: Remove this check since debugfs_create_file can handle IS_ERR pointers. And drop the ifdef CONFIG_DEBUG_FS statement. v1: https://lore.kernel.org/all/20240903143607.2004802-1-lizetao1@huawei.com/ drivers/media/cec/core/cec-core.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c index e0756826d629..77be6c11c63c 100644 --- a/drivers/media/cec/core/cec-core.c +++ b/drivers/media/cec/core/cec-core.c @@ -439,13 +439,7 @@ static int __init cec_devnode_init(void) return ret; } -#ifdef CONFIG_DEBUG_FS top_cec_dir = debugfs_create_dir("cec", NULL); - if (IS_ERR_OR_NULL(top_cec_dir)) { - pr_warn("cec: Failed to create debugfs cec dir\n"); - top_cec_dir = NULL; - } -#endif ret = bus_register(&cec_bus_type); if (ret < 0) { From patchwork Sat Sep 7 03:44:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 104065 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1smmEM-0004Ux-2p for patchwork@linuxtv.org; Sat, 07 Sep 2024 03:35:23 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 42E1F284768 for ; Sat, 7 Sep 2024 03:35:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48A843B1BC; Sat, 7 Sep 2024 03:35:15 +0000 (UTC) X-Original-To: linux-media@vger.kernel.org Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9C9CEAE9 for ; Sat, 7 Sep 2024 03:35:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725680115; cv=none; b=mupveE5Ju2KGJHWmLHmOaMwevXJsmMVV1beDf32Wklm09mg725coGUPMXV/JqTVtDHRrQVDUSyaEonqGOEzeIiZDNEvif1cdqScrb7y4/1mIiMoPNhAN1mFmuU3Wc0BiUdrV0ATsTNPWGUaes8AEJ1b3hvL0x0KrCNzQENZgMpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725680115; c=relaxed/simple; bh=9ndR7JYgXlK6gaL2DuxYVbZkag02HgoUfkhmww6ZP34=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t90vrNFihMdIPE+k/gDyeROfW8WSYPhShAPvjfSpl9TVGXqzV9r3+cWNTxkhubj0PLS5jppM5VfYzcuUR3yACmWnYWsI2pQxCyXp5VqoaWtWrl8jVUb+c5b7RfDWjvH0/WJQfvHI+xkCLodYoZaC7sA+At3y/A0aw81/ScyuPJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4X0zGn6v74z1BMZZ; Sat, 7 Sep 2024 11:34:09 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id E22C6180A9E; Sat, 7 Sep 2024 11:35:10 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Sat, 7 Sep 2024 11:35:10 +0800 From: Li Zetao To: , , , , , , CC: Subject: [PATCH -next v2 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init() Date: Sat, 7 Sep 2024 11:44:00 +0800 Message-ID: <20240907034400.3693797-2-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907034400.3693797-1-lizetao1@huawei.com> References: <20240907034400.3693797-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemd500012.china.huawei.com (7.221.188.25) X-LSpam-Score: -7.3 (-------) X-LSpam-Report: No, score=-7.3 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DMARC_QUAR=1.198,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_VALIDITY_CERTIFIED=-3,RCVD_IN_VALIDITY_RPBL=1.31,RCVD_IN_VALIDITY_SAFE=-2,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=ham autolearn_force=no Since the debugfs_create_dir() never returns a null pointer, checking the return value for a null pointer is redundant, Remove this check since debugfs_create_file can handle IS_ERR pointers. Signed-off-by: Li Zetao --- v1 -> v2: Remove this check since debugfs_create_file can handle IS_ERR pointers. v1: https://lore.kernel.org/all/20240903143607.2004802-2-lizetao1@huawei.com/ drivers/media/common/siano/smsdvb-debugfs.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c index 73990e469df9..9db38ae4ecee 100644 --- a/drivers/media/common/siano/smsdvb-debugfs.c +++ b/drivers/media/common/siano/smsdvb-debugfs.c @@ -411,10 +411,6 @@ void smsdvb_debugfs_register(void) * subsystem. */ d = debugfs_create_dir("smsdvb", usb_debug_root); - if (IS_ERR_OR_NULL(d)) { - pr_err("Couldn't create sysfs node for smsdvb\n"); - return; - } smsdvb_debugfs_usb_root = d; }