[linux-yocto][v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc][PATCH] clk: clocking-wizard: use devm_kasprintf to fix kmemleak

2024-03-01 Thread quanyang.wang via lists.yoctoproject.org
From: Quanyang Wang 

Use devm_kasprintf instead of kasprintf to fix the following kmemleak:

unreferenced object 0xff8803ed7280 (size 128):
  comm "kworker/u8:1", pid 11, jiffies 4294892718 (age 234.496s)
  hex dump (first 32 bytes):
38 30 30 31 30 30 30 30 2e 63 6c 6b 5f 77 69 7a  8001.clk_wiz
5f 6f 75 74 30 00 00 00 00 00 00 00 00 00 00 00  _out0...
  backtrace:
[] __kmem_cache_alloc_node+0x3fc/0x5f0
[] __kmalloc_node_track_caller+0x5c/0x228
[<68e52a86>] kvasprintf+0x8c/0x118
[] kasprintf+0x5c/0x88
[<934884a9>] clk_wzrd_probe+0x374/0x730
[<167096d4>] platform_probe+0x70/0xe0
[] really_probe+0xc4/0x2b0
[<5eafe737>] __driver_probe_device+0x80/0x120
[<26f774f1>] driver_probe_device+0x48/0xf0
[<9bed11ed>] __device_attach_driver+0xc0/0x100
[<12782b09>] bus_for_each_drv+0x80/0xd8
[<08a5cc26>] __device_attach+0x104/0x198
[] device_initial_probe+0x1c/0x28
[] bus_probe_device+0xa4/0xb0
[<191df268>] deferred_probe_work_func+0x90/0xc8
[] process_one_work+0x1f4/0x460

Signed-off-by: Quanyang Wang 
---
Hi Bruce,
Would you please help merge this patch to the branches:
v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc
v6.1/standard/sdkv6.1/xlnx-soc
Thanks,
Quanyang
---
 drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c 
b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
index e68be24a26e9d..4391eced19793 100644
--- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
+++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
@@ -645,7 +645,7 @@ static int clk_wzrd_probe(struct platform_device *pdev)
goto err_disable_clk;
}
 
-   clkout_name = kasprintf(GFP_KERNEL, "%s_out0", dev_name(&pdev->dev));
+   clkout_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_out0", 
dev_name(&pdev->dev));
if (nr_outputs == 1) {
clk_wzrd->clkout[0] = clk_wzrd_register_divider
(&pdev->dev, clkout_name,
@@ -666,7 +666,7 @@ static int clk_wzrd_probe(struct platform_device *pdev)
reg = reg & WZRD_CLKFBOUT_MULT_MASK;
reg =  reg >> WZRD_CLKFBOUT_MULT_SHIFT;
mult = (reg * 1000) + reg_f;
-   clk_name = kasprintf(GFP_KERNEL, "%s_mul", dev_name(&pdev->dev));
+   clk_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_mul", 
dev_name(&pdev->dev));
if (!clk_name) {
ret = -ENOMEM;
goto err_disable_clk;
@@ -675,14 +675,13 @@ static int clk_wzrd_probe(struct platform_device *pdev)
(&pdev->dev, clk_name,
 __clk_get_name(clk_wzrd->clk_in1),
0, mult, 1000);
-   kfree(clk_name);
if (IS_ERR(clk_wzrd->clks_internal[wzrd_clk_mul])) {
dev_err(&pdev->dev, "unable to register fixed-factor clock\n");
ret = PTR_ERR(clk_wzrd->clks_internal[wzrd_clk_mul]);
goto err_disable_clk;
}
 
-   clk_name = kasprintf(GFP_KERNEL, "%s_mul_div", dev_name(&pdev->dev));
+   clk_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_mul_div", 
dev_name(&pdev->dev));
if (!clk_name) {
ret = -ENOMEM;
goto err_rm_int_clk;
@@ -703,7 +702,8 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 
/* register div per output */
for (i = nr_outputs - 1; i >= 0 ; i--) {
-   clkout_name = kasprintf(GFP_KERNEL, "%s_out%d", 
dev_name(&pdev->dev), i);
+   clkout_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_out%d",
+   dev_name(&pdev->dev), i);
if (!clkout_name) {
ret = -ENOMEM;
goto err_rm_int_clk;
@@ -739,7 +739,6 @@ static int clk_wzrd_probe(struct platform_device *pdev)
}
}
 
-   kfree(clk_name);
 out:
clk_wzrd->clk_data.clks = clk_wzrd->clkout;
clk_wzrd->clk_data.clk_num = ARRAY_SIZE(clk_wzrd->clkout);
@@ -765,7 +764,6 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 err_rm_int_clks:
clk_unregister(clk_wzrd->clks_internal[1]);
 err_rm_int_clk:
-   kfree(clk_name);
clk_unregister(clk_wzrd->clks_internal[0]);
 err_disable_clk:
clk_disable_unprepare(clk_wzrd->axi_clk);
-- 
2.36.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13620): 
https://lists.yoctoproject.org/g/linux-yocto/message/13620
Mute This Topic: https://lists.yoctoproject.org/mt/104660586/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-

[linux-yocto][linux-yocto v6.1] kernel code for marvell cn10xxx

2024-03-01 Thread Ruiqiang Hao via lists.yoctoproject.org
Hi Bruce,

Please help to merge this patch into our linux-yocto repo.

repo:
linux-yocto
branch:
v6.1/standard/cn-sdkv5.15/octeon
v6.1/standard/preempt-rt/cn-sdkv5.15/octeon

Thanks,
Ruiqiang

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13621): 
https://lists.yoctoproject.org/g/linux-yocto/message/13621
Mute This Topic: https://lists.yoctoproject.org/mt/104661505/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [PATCH] gpio: thunderx: Convert to immutable irq_chip

2024-03-01 Thread Ruiqiang Hao via lists.yoctoproject.org
From: Linus Walleij 

commit ef902f54e91b3012586f6387daeebec2966312f0 upstream.

Convert the driver to immutable irq-chip with a bit of
intuition.

Whereas in most cases we put the gpiochip_[enable|disable]_irq()
calls in the .irq_mask() and .irq_unmask() callbacks, here
we need to put them in the .irq_enable() and .irq_disable()
callbacks, as this driver uses both .irq_mask() and
.irq_mask_ack().

Cc: Marc Zyngier 
Signed-off-by: Linus Walleij 
Reviewed-by: Marc Zyngier 
Signed-off-by: Bartosz Golaszewski 
Signed-off-by: Ruiqiang Hao 
---
 drivers/gpio/gpio-thunderx.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
index 909b31e0e1ae..49c4c28b567f 100644
--- a/drivers/gpio/gpio-thunderx.c
+++ b/drivers/gpio/gpio-thunderx.c
@@ -358,16 +358,22 @@ static int thunderx_gpio_irq_set_type(struct irq_data *d,
return IRQ_SET_MASK_OK;
 }
 
-static void thunderx_gpio_irq_enable(struct irq_data *data)
+static void thunderx_gpio_irq_enable(struct irq_data *d)
 {
-   irq_chip_enable_parent(data);
-   thunderx_gpio_irq_unmask(data);
+   struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+
+   gpiochip_enable_irq(gc, irqd_to_hwirq(d));
+   irq_chip_enable_parent(d);
+   thunderx_gpio_irq_unmask(d);
 }
 
-static void thunderx_gpio_irq_disable(struct irq_data *data)
+static void thunderx_gpio_irq_disable(struct irq_data *d)
 {
-   thunderx_gpio_irq_mask(data);
-   irq_chip_disable_parent(data);
+   struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+
+   thunderx_gpio_irq_mask(d);
+   irq_chip_disable_parent(d);
+   gpiochip_disable_irq(gc, irqd_to_hwirq(d));
 }
 
 /*
@@ -376,7 +382,7 @@ static void thunderx_gpio_irq_disable(struct irq_data *data)
  * semantics and other acknowledgment tasks associated with the GPIO
  * mechanism.
  */
-static struct irq_chip thunderx_gpio_irq_chip = {
+static const struct irq_chip thunderx_gpio_irq_chip = {
.name   = "GPIO",
.irq_enable = thunderx_gpio_irq_enable,
.irq_disable= thunderx_gpio_irq_disable,
@@ -387,8 +393,8 @@ static struct irq_chip thunderx_gpio_irq_chip = {
.irq_eoi= irq_chip_eoi_parent,
.irq_set_affinity   = irq_chip_set_affinity_parent,
.irq_set_type   = thunderx_gpio_irq_set_type,
-
-   .flags  = IRQCHIP_SET_TYPE_MASKED
+   .flags  = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_IMMUTABLE,
+   GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
 static int thunderx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
@@ -555,7 +561,7 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
chip->set_multiple = thunderx_gpio_set_multiple;
chip->set_config = thunderx_gpio_set_config;
girq = &chip->irq;
-   girq->chip = &thunderx_gpio_irq_chip;
+   gpio_irq_chip_set_chip(girq, &thunderx_gpio_irq_chip);
girq->fwnode = of_node_to_fwnode(dev->of_node);
girq->parent_domain =
irq_get_irq_data(txgpio->msix_entries[0].vector)->domain;
-- 
2.43.2


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13622): 
https://lists.yoctoproject.org/g/linux-yocto/message/13622
Mute This Topic: https://lists.yoctoproject.org/mt/104661507/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-