* [PATCH next] Coresight: Fix a NULL vs IS_ERR() bug in probe
@ 2025-03-14 10:55 Dan Carpenter
2025-03-17 1:07 ` Jie Gan
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Dan Carpenter @ 2025-03-14 10:55 UTC (permalink / raw)
To: Jie Gan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
coresight, linux-arm-kernel, linux-kernel, kernel-janitors
The devm_platform_get_and_ioremap_resource() function doesn't
return NULL, it returns error pointers. Update the checking to
match.
Fixes: f78d206f3d73 ("Coresight: Add Coresight TMC Control Unit driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/hwtracing/coresight/coresight-ctcu-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hwtracing/coresight/coresight-ctcu-core.c
index da35d8b4d579..c6bafc96db96 100644
--- a/drivers/hwtracing/coresight/coresight-ctcu-core.c
+++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c
@@ -204,8 +204,8 @@ static int ctcu_probe(struct platform_device *pdev)
dev->platform_data = pdata;
base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
- if (!base)
- return -ENOMEM;
+ if (IS_ERR(base))
+ return PTR_ERR(base);
drvdata->apb_clk = coresight_get_enable_apb_pclk(dev);
if (IS_ERR(drvdata->apb_clk))
--
2.47.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH next] Coresight: Fix a NULL vs IS_ERR() bug in probe
2025-03-14 10:55 [PATCH next] Coresight: " Dan Carpenter
@ 2025-03-17 1:07 ` Jie Gan
2025-03-17 2:13 ` Anshuman Khandual
2025-03-17 10:07 ` Suzuki K Poulose
2 siblings, 0 replies; 9+ messages in thread
From: Jie Gan @ 2025-03-17 1:07 UTC (permalink / raw)
To: Dan Carpenter
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
coresight, linux-arm-kernel, linux-kernel, kernel-janitors
On 3/14/2025 6:55 PM, Dan Carpenter wrote:
> The devm_platform_get_and_ioremap_resource() function doesn't
> return NULL, it returns error pointers. Update the checking to
> match.
>
> Fixes: f78d206f3d73 ("Coresight: Add Coresight TMC Control Unit driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-ctcu-core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hwtracing/coresight/coresight-ctcu-core.c
> index da35d8b4d579..c6bafc96db96 100644
> --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c
> +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c
> @@ -204,8 +204,8 @@ static int ctcu_probe(struct platform_device *pdev)
> dev->platform_data = pdata;
>
> base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
> - if (!base)
> - return -ENOMEM;
> + if (IS_ERR(base))
> + return PTR_ERR(base);
>
> drvdata->apb_clk = coresight_get_enable_apb_pclk(dev);
> if (IS_ERR(drvdata->apb_clk))
Thanks for fix it. Looks good to me.
Reviewed-by: Jie Gan <quic_jiegan@quicinc.com>
Jie
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH next] Coresight: Fix a NULL vs IS_ERR() bug in probe
2025-03-14 10:55 [PATCH next] Coresight: " Dan Carpenter
2025-03-17 1:07 ` Jie Gan
@ 2025-03-17 2:13 ` Anshuman Khandual
2025-03-17 10:07 ` Suzuki K Poulose
2 siblings, 0 replies; 9+ messages in thread
From: Anshuman Khandual @ 2025-03-17 2:13 UTC (permalink / raw)
To: Dan Carpenter, Jie Gan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
coresight, linux-arm-kernel, linux-kernel, kernel-janitors
On 3/14/25 16:25, Dan Carpenter wrote:
> The devm_platform_get_and_ioremap_resource() function doesn't
> return NULL, it returns error pointers. Update the checking to
> match.
>
> Fixes: f78d206f3d73 ("Coresight: Add Coresight TMC Control Unit driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-ctcu-core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hwtracing/coresight/coresight-ctcu-core.c
> index da35d8b4d579..c6bafc96db96 100644
> --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c
> +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c
> @@ -204,8 +204,8 @@ static int ctcu_probe(struct platform_device *pdev)
> dev->platform_data = pdata;
>
> base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
> - if (!base)
> - return -ENOMEM;
> + if (IS_ERR(base))
> + return PTR_ERR(base);
>
> drvdata->apb_clk = coresight_get_enable_apb_pclk(dev);
> if (IS_ERR(drvdata->apb_clk))
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH next] Coresight: Fix a NULL vs IS_ERR() bug in probe
2025-03-14 10:55 [PATCH next] Coresight: " Dan Carpenter
2025-03-17 1:07 ` Jie Gan
2025-03-17 2:13 ` Anshuman Khandual
@ 2025-03-17 10:07 ` Suzuki K Poulose
2 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2025-03-17 10:07 UTC (permalink / raw)
To: Jie Gan, Dan Carpenter
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
coresight, linux-arm-kernel, linux-kernel, kernel-janitors
On Fri, 14 Mar 2025 13:55:10 +0300, Dan Carpenter wrote:
> The devm_platform_get_and_ioremap_resource() function doesn't
> return NULL, it returns error pointers. Update the checking to
> match.
>
>
Applied, thanks!
[1/1] Coresight: Fix a NULL vs IS_ERR() bug in probe
(no commit info)
Best regards,
--
Suzuki K Poulose <suzuki.poulose@arm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe
@ 2025-07-16 19:38 Dan Carpenter
2025-07-18 12:47 ` Mike Leach
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Dan Carpenter @ 2025-07-16 19:38 UTC (permalink / raw)
To: Yuanfang Zhang
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Leo Yan, coresight, linux-arm-kernel, linux-kernel,
kernel-janitors
The devm_ioremap_resource() function returns error pointers on error.
It never returns NULL. Update the error checking to match.
Fixes: 26e20622a8ae ("coresight: add coresight Trace Network On Chip driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/hwtracing/coresight/coresight-tnoc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
index 0e4164707eea..d542df46ea39 100644
--- a/drivers/hwtracing/coresight/coresight-tnoc.c
+++ b/drivers/hwtracing/coresight/coresight-tnoc.c
@@ -183,8 +183,8 @@ static int trace_noc_probe(struct amba_device *adev, const struct amba_id *id)
dev_set_drvdata(dev, drvdata);
drvdata->base = devm_ioremap_resource(dev, &adev->res);
- if (!drvdata->base)
- return -ENOMEM;
+ if (IS_ERR(drvdata->base))
+ return PTR_ERR(drvdata->base);
spin_lock_init(&drvdata->spinlock);
--
2.47.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe
2025-07-16 19:38 [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe Dan Carpenter
@ 2025-07-18 12:47 ` Mike Leach
2025-07-21 11:16 ` Anshuman Khandual
2025-07-21 11:23 ` Suzuki K Poulose
2 siblings, 0 replies; 9+ messages in thread
From: Mike Leach @ 2025-07-18 12:47 UTC (permalink / raw)
To: Dan Carpenter
Cc: Yuanfang Zhang, Suzuki K Poulose, James Clark, Alexander Shishkin,
Leo Yan, coresight, linux-arm-kernel, linux-kernel,
kernel-janitors
On Wed, 16 Jul 2025 at 20:38, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The devm_ioremap_resource() function returns error pointers on error.
> It never returns NULL. Update the error checking to match.
>
> Fixes: 26e20622a8ae ("coresight: add coresight Trace Network On Chip driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-tnoc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
> index 0e4164707eea..d542df46ea39 100644
> --- a/drivers/hwtracing/coresight/coresight-tnoc.c
> +++ b/drivers/hwtracing/coresight/coresight-tnoc.c
> @@ -183,8 +183,8 @@ static int trace_noc_probe(struct amba_device *adev, const struct amba_id *id)
> dev_set_drvdata(dev, drvdata);
>
> drvdata->base = devm_ioremap_resource(dev, &adev->res);
> - if (!drvdata->base)
> - return -ENOMEM;
> + if (IS_ERR(drvdata->base))
> + return PTR_ERR(drvdata->base);
>
> spin_lock_init(&drvdata->spinlock);
>
> --
> 2.47.2
>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe
2025-07-16 19:38 [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe Dan Carpenter
2025-07-18 12:47 ` Mike Leach
@ 2025-07-21 11:16 ` Anshuman Khandual
2025-07-24 13:29 ` Leo Yan
2025-07-21 11:23 ` Suzuki K Poulose
2 siblings, 1 reply; 9+ messages in thread
From: Anshuman Khandual @ 2025-07-21 11:16 UTC (permalink / raw)
To: Dan Carpenter, Yuanfang Zhang
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Leo Yan, coresight, linux-arm-kernel, linux-kernel,
kernel-janitors
On 17/07/25 1:08 AM, Dan Carpenter wrote:
> The devm_ioremap_resource() function returns error pointers on error.
> It never returns NULL. Update the error checking to match.
>
> Fixes: 26e20622a8ae ("coresight: add coresight Trace Network On Chip driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-tnoc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
> index 0e4164707eea..d542df46ea39 100644
> --- a/drivers/hwtracing/coresight/coresight-tnoc.c
> +++ b/drivers/hwtracing/coresight/coresight-tnoc.c
> @@ -183,8 +183,8 @@ static int trace_noc_probe(struct amba_device *adev, const struct amba_id *id)
> dev_set_drvdata(dev, drvdata);
>
> drvdata->base = devm_ioremap_resource(dev, &adev->res);
> - if (!drvdata->base)
> - return -ENOMEM;
> + if (IS_ERR(drvdata->base))
> + return PTR_ERR(drvdata->base);
>
> spin_lock_init(&drvdata->spinlock);
>
Do we still have more similar instances in coresight ?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe
2025-07-16 19:38 [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe Dan Carpenter
2025-07-18 12:47 ` Mike Leach
2025-07-21 11:16 ` Anshuman Khandual
@ 2025-07-21 11:23 ` Suzuki K Poulose
2 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2025-07-21 11:23 UTC (permalink / raw)
To: Yuanfang Zhang, Dan Carpenter
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Leo Yan, coresight, linux-arm-kernel, linux-kernel,
kernel-janitors
On Wed, 16 Jul 2025 14:38:30 -0500, Dan Carpenter wrote:
> The devm_ioremap_resource() function returns error pointers on error.
> It never returns NULL. Update the error checking to match.
>
>
Applied, thanks!
[1/1] coresight: Fix a NULL vs IS_ERR() bug in probe
https://git.kernel.org/coresight/c/f59b9437ac95
Best regards,
--
Suzuki K Poulose <suzuki.poulose@arm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe
2025-07-21 11:16 ` Anshuman Khandual
@ 2025-07-24 13:29 ` Leo Yan
0 siblings, 0 replies; 9+ messages in thread
From: Leo Yan @ 2025-07-24 13:29 UTC (permalink / raw)
To: Anshuman Khandual
Cc: Dan Carpenter, Yuanfang Zhang, Suzuki K Poulose, Mike Leach,
James Clark, Alexander Shishkin, coresight, linux-arm-kernel,
linux-kernel, kernel-janitors
On Mon, Jul 21, 2025 at 04:46:30PM +0530, Anshuman Khandual wrote:
[...]
> > diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
> > index 0e4164707eea..d542df46ea39 100644
> > --- a/drivers/hwtracing/coresight/coresight-tnoc.c
> > +++ b/drivers/hwtracing/coresight/coresight-tnoc.c
> > @@ -183,8 +183,8 @@ static int trace_noc_probe(struct amba_device *adev, const struct amba_id *id)
> > dev_set_drvdata(dev, drvdata);
> >
> > drvdata->base = devm_ioremap_resource(dev, &adev->res);
> > - if (!drvdata->base)
> > - return -ENOMEM;
> > + if (IS_ERR(drvdata->base))
> > + return PTR_ERR(drvdata->base);
> >
> > spin_lock_init(&drvdata->spinlock);
> >
>
> Do we still have more similar instances in coresight ?
It is a bit shame that I have enabled smatch for static checking but
did not verify this series.
I can confirm that the coresight driver does not have such issue in the
current code base. After merging the CoreSight clock fix series, we
should be able to dismiss all errors reported by smatch in CoreSight
drivers.
A side topic, I observed that smatch does not like the long functions
in drivers/hwtracing/coresight/coresight-etm4x-core.c. So I built a
smatch version with relaxed limits.
---8<---
diff --git a/smatch_implied.c b/smatch_implied.c
index 9055d676..7469f1ac 100644
--- a/smatch_implied.c
+++ b/smatch_implied.c
@@ -462,13 +462,13 @@ static int going_too_slow(void)
return 1;
}
- if (time_parsing_function() < 60) {
+ if (time_parsing_function() < 300) {
implications_off = false;
return 0;
}
if (!__inline_fn && printed != cur_func_sym) {
- sm_perror("turning off implications after 60 seconds");
+ sm_perror("turning off implications after 300 seconds");
printed = cur_func_sym;
}
implications_off = true;
diff --git a/smatch_slist.c b/smatch_slist.c
index cc3d73b7..039cdae7 100644
--- a/smatch_slist.c
+++ b/smatch_slist.c
@@ -321,7 +321,7 @@ char *alloc_sname(const char *str)
}
static struct symbol *oom_func;
-static int oom_limit = 3000000; /* Start with a 3GB limit */
+static int oom_limit = 4000000; /* Start with a 4GB limit */
int out_of_memory(void)
{
if (oom_func)
@@ -332,7 +332,7 @@ int out_of_memory(void)
* It works out OK for the kernel and so it should work
* for most other projects as well.
*/
- if (sm_state_counter * sizeof(struct sm_state) >= 100000000)
+ if (sm_state_counter * sizeof(struct sm_state) >= 500000000)
return 1;
/*
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-07-24 13:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 19:38 [PATCH next] coresight: Fix a NULL vs IS_ERR() bug in probe Dan Carpenter
2025-07-18 12:47 ` Mike Leach
2025-07-21 11:16 ` Anshuman Khandual
2025-07-24 13:29 ` Leo Yan
2025-07-21 11:23 ` Suzuki K Poulose
-- strict thread matches above, loose matches on Subject: below --
2025-03-14 10:55 [PATCH next] Coresight: " Dan Carpenter
2025-03-17 1:07 ` Jie Gan
2025-03-17 2:13 ` Anshuman Khandual
2025-03-17 10:07 ` Suzuki K Poulose
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).