Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()
@ 2024-09-07  3:43 Li Zetao
  2024-09-07  3:44 ` [PATCH -next v2 2/2] media: siano: " Li Zetao
  2024-09-09 11:49 ` [PATCH -next v2 1/2] media: cec: " Hans Verkuil
  0 siblings, 2 replies; 5+ messages in thread
From: Li Zetao @ 2024-09-07  3:43 UTC (permalink / raw)
  To: hverkuil-cisco, mchehab, gregkh, lizetao1,
	laurent.pinchart+renesas, ricardo, ruanjinjie
  Cc: linux-media

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 <lizetao1@huawei.com>
---
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) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH net-next v2 00/10] net: Convert using devm_clk_get_enabled()/devm_clk_get_optional_enabled()
@ 2024-09-07  3:09 Li Zetao
  2024-09-07  3:10 ` [PATCH -next v2 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init() Li Zetao
  0 siblings, 1 reply; 5+ messages in thread
From: Li Zetao @ 2024-09-07  3:09 UTC (permalink / raw)
  To: mchehab, davem, edumazet, kuba, pabeni, wens, jernej.skrabec,
	samuel, heiko, yisen.zhuang, salil.mehta, hauke, alexandre.torgue,
	joabreu, mcoquelin.stm32, wellslutw, radhey.shyam.pandey,
	michal.simek, hdegoede, ilpo.jarvinen, lizetao1, ruanjinjie,
	hverkuil-cisco, u.kleine-koenig, jacky_chou, jacob.e.keller
  Cc: linux-media, netdev, linux-arm-kernel, linux-sunxi,
	linux-rockchip, linux-stm32, platform-driver-x86

v1 -> v2:
  1) Patch 5 optimizes the check and adds commit information for easier
  inspection.
  2) It is no longer necessary to use clk, so delete the clk member of
  the spl2sw_common structure.
  3) Remove patches 11 and 12, they should be sent to wireless-next
  individually

v1:
https://lore.kernel.org/all/20240831021334.1907921-1-lizetao1@huawei.com/

There are many examples[1][2] of clk resource leakage in LTS. The
reason is that developers need to maintain the allocation and release
of clk resources themselves, but this will increase the burden on
developers. Using the API related to devm_clk_get_*_enable ensures
that the life cycle of clk is consistent with that of the device,
reducing the risk of unreleased resources like clk.

Several other developers are also working on converting to more
secure interfaces, and this patch set is in principle the same as
theirs.

[1]:
https://lore.kernel.org/all/20240812160128.338041191@linuxfoundation.org/
[2]:
https://lore.kernel.org/all/20240812160135.992451065@linuxfoundation.org/

Li Zetao (10):
  net: dsa: bcm_sf2: Convert using devm_clk_get_optional_enabled() in
    bcm_sf2_sw_probe()
  net: ethernet: Convert using devm_clk_get_enabled() in emac_probe()
  net: ethernet: arc: Convert using devm_clk_get_enabled() in
    emac_probe()
  net: ethernet: ethoc: Convert using devm_clk_get_enabled() in
    ethoc_probe()
  net: ftgmac100: Convert using devm_clk_get_enabled() in
    ftgmac100_setup_clk()
  net: ethernet: hisilicon: Convert using devm_clk_get_enabled() in
    hisi_femac_drv_probe()
  net: lantiq_xrx200: Convert using devm_clk_get_enabled() in
    xrx200_probe()
  net: stmmac: dwmac-dwc-qos-eth: Convert using devm_clk_get_enabled()
    in dwc_qos_probe()
  net: ethernet: sunplus: Convert using devm_clk_get_enabled() in
    spl2sw_probe()
  net: xilinx: axienet: Convert using devm_clk_get_optional_enabled() in
    axienet_probe()

 drivers/net/dsa/bcm_sf2.c                     | 28 ++----
 drivers/net/ethernet/allwinner/sun4i-emac.c   | 13 +--
 drivers/net/ethernet/arc/emac_rockchip.c      | 34 ++-----
 drivers/net/ethernet/ethoc.c                  | 18 ++--
 drivers/net/ethernet/faraday/ftgmac100.c      | 26 +----
 drivers/net/ethernet/hisilicon/hisi_femac.c   | 17 +---
 drivers/net/ethernet/lantiq_xrx200.c          | 17 +---
 .../stmicro/stmmac/dwmac-dwc-qos-eth.c        | 98 ++++---------------
 drivers/net/ethernet/sunplus/spl2sw_define.h  |  1 -
 drivers/net/ethernet/sunplus/spl2sw_driver.c  | 25 ++---
 .../net/ethernet/xilinx/xilinx_axienet_main.c | 15 +--
 11 files changed, 62 insertions(+), 230 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-09 11:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-07  3:43 [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
2024-09-07  3:44 ` [PATCH -next v2 2/2] media: siano: " Li Zetao
2024-09-07  5:48   ` Greg KH
2024-09-09 11:49 ` [PATCH -next v2 1/2] media: cec: " Hans Verkuil
  -- strict thread matches above, loose matches on Subject: below --
2024-09-07  3:09 [PATCH net-next v2 00/10] net: Convert using devm_clk_get_enabled()/devm_clk_get_optional_enabled() Li Zetao
2024-09-07  3:10 ` [PATCH -next v2 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init() Li Zetao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox