PM / devfreq: exynos-nocp: Checking for IS_ERR instead of NULL
Subsystems (4)
PATCH 1/1 PM / devfreq: exynos-nocp: Checking for IS_ERR instead of NULL
The platform_get_resource() function returns NULL on error, it never returns error pointers.
drivers/devfreq/event/exynos-nocp.c +2 -2
@@ -220,8 +220,8 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); +if (!res) +return -ENXIO ; base =devm_ioremap_resource (dev, res);if (IS_ERR (base))
Hi Dan,
Quoted 11 lines · Dan Carpenter
The
platform_get_resource()function returns NULL on error, it never returns error pointers.Fixes 0179a913875a ('PM / devfreq: event: Add new Exynos NoC probe driver')Signed-off-by Dan Carpenter <[email protected]>drivers/devfreq/event/exynos-nocp.c +0
-0
drivers/devfreq/event/exynos-nocp.c static int exynos_nocp_parse_dt(struct platform_device *pdev, · line 227
Quoted 10 lines
drivers/devfreq/event/exynos-nocp.c +2
-2@@ -220,8 +220,8 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); +if (!res) +return -ENXIO ; base =devm_ioremap_resource (dev, res);if (IS_ERR (base))
Thanks,
Chanwoo Choi
Quoted 11 lines · Dan Carpenter
The
platform_get_resource()function returns NULL on error, it never returns error pointers.Fixes 0179a913875a ('PM / devfreq: event: Add new Exynos NoC probe driver')Signed-off-by Dan Carpenter <[email protected]>drivers/devfreq/event/exynos-nocp.c +0
-0
drivers/devfreq/event/exynos-nocp.c static int exynos_nocp_parse_dt(struct platform_device *pdev, · line 227
Quoted 10 lines
drivers/devfreq/event/exynos-nocp.c +2
-2@@ -220,8 +220,8 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); +if (!res) +return -ENXIO ; base =devm_ioremap_resource (dev, res);if (IS_ERR (base))
Looks good to me.
Thanks,
Chanwoo Choi
Quoted 20 lines · Chanwoo Choi
Quoted 19 lines · Dan Carpenter
The
platform_get_resource()function returns NULL on error, it never returns error pointers.Fixes 0179a913875a ('PM / devfreq: event: Add new Exynos NoC probe driver')Signed-off-by Dan Carpenter <[email protected]>drivers/devfreq/event/exynos-nocp.c +2
-2@@ -220,8 +220,8 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); +if (!res) +return -ENXIO ;
Quoted 4 lines
drivers/devfreq/event/exynos-nocp.c static int exynos_nocp_parse_dt(struct platform_device *pdev, · line 227
Quoted 2 lines
drivers/devfreq/event/exynos-nocp.c +0
-0base =devm_ioremap_resource (dev, res);if (IS_ERR (base))Looks good to me.
I believe that there is no need for the test at all. devm_ioremap_resource should make the test.
julia
Quoted 11 lines
Reviewed-by Chanwoo Choi <[email protected]>Thanks,
Chanwoo Choi--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · Julia Lawall
Quoted 20 lines · Chanwoo Choi
Quoted 19 lines · Dan Carpenter
The
platform_get_resource()function returns NULL on error, it never returns error pointers.Fixes 0179a913875a ('PM / devfreq: event: Add new Exynos NoC probe driver')Signed-off-by Dan Carpenter <[email protected]>drivers/devfreq/event/exynos-nocp.c +2
-2@@ -220,8 +220,8 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); +if (!res) +return -ENXIO ;
Quoted 7 lines
Quoted 4 lines
drivers/devfreq/event/exynos-nocp.c static int exynos_nocp_parse_dt(struct platform_device *pdev, · line 227
Quoted 2 lines
drivers/devfreq/event/exynos-nocp.c +0
-0base =devm_ioremap_resource (dev, res);if (IS_ERR (base))Looks good to me.
I believe that there is no need for the test at all.
devm_ioremap_resourceshould make the test.
True. The static checker warning here is just that "res" isn't an error pointer, not that we dereference it.
I'll resend.
regards,
dan carpenter
PATCH v2 1/1 PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
In reply to Julia LawallSmatch complains because platform_get_resource() returns NULL on error and not an error pointer so the check is wrong. Julia Lawall pointed out that normally we don't check these, because devm_ioremap_resource() has a check for NULL.
---
v2: just remove the check
drivers/devfreq/event/exynos-nocp.c +0 -3
@@ -220,9 +220,6 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); - base =devm_ioremap_resource (dev, res);if (IS_ERR (base))return PTR_ERR (base);
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Hi Dan,
Quoted 14 lines · Dan Carpenter
Smatch complains because
platform_get_resource()returns NULL on error and not an error pointer so the check is wrong. Julia Lawall pointed out that normally we don't check these, becausedevm_ioremap_resource()has a check for NULL.Signed-off-by Dan Carpenter <[email protected]>---
v2: just remove the checkdrivers/devfreq/event/exynos-nocp.c +0
-0
drivers/devfreq/event/exynos-nocp.c static int exynos_nocp_parse_dt(struct platform_device *pdev, · line 225
Quoted 9 lines
drivers/devfreq/event/exynos-nocp.c +0
-3@@ -220,9 +220,6 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); - base =devm_ioremap_resource (dev, res);if (IS_ERR (base))return PTR_ERR (base);
I don't recommend that you mention the name of engineer on patch description directly. Except for this comment, looks good to me.
Thanks,
Chanwoo Choi
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly. Except for this comment, looks good to me.
I always feel it's nicer to give credit. Plus Julia is already a well known kernel dev and this was a pubic list. (I wouldn't give credit if she had sent hurtful comments about my spelling to me privately, for example).
regards,
dan carpenter
Chanwoo Choi
maintainerRe: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 8 lines · Dan Carpenter
Quoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly. Except for this comment, looks good to me.
I always feel it's nicer to give credit. Plus Julia is already a well known kernel dev and this was a pubic list. (I wouldn't give credit if she had sent hurtful comments about my spelling to me privately, for example).
If you want to give credit as you mentioned, you can add the acked-by or signed-off for Julia. But, usually, the patch description don't include the engineer's name directly.
Thanks,
Chanwoo Choi
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Signed-off-by is like signing a legal document to say that you haven't stolen any of the code from SCO Unix. Please don't put sign for other people.
regards,
dan carpenter
Chanwoo Choi
maintainerRe: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 3 lines · Dan Carpenter
Signed-off-by is like signing a legal document to say that you haven't stolen any of the code from SCO Unix. Please don't put sign for other people.
You're right. I'm forcing to put the Sign-off. It is just example.
But, I still think that patch description including the engineer's name is not appropriate to give the credit someone.
Thanks,
Chanwoo Choi
Chanwoo Choi
maintainerRe: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 10 lines · Chanwoo Choi
Quoted 3 lines · Dan Carpenter
Signed-off-by is like signing a legal document to say that you haven't stolen any of the code from SCO Unix. Please don't put sign for other people.
You're right. I'm forcing to put the Sign-off. It is just example.
But, I still think that patch description including the engineer's name is not appropriate to give the credit someone.
Also, If Julia review this patch, you just can add the reviewed-by tag. I think that it is enough.
Thanks,
Chanwoo Choi
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
In reply to Chanwoo ChoiQuoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly.
This really is normal. I've been mentioned over 100 times in commit messages like 7051924f771 (xillybus: Move out of staging).
regards,
dan carpenter
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 6 lines · Dan Carpenter
Quoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly.
This really is normal. I've been mentioned over 100 times in commit messages like
7051924f771(xillybus: Move out of staging).
I'm still reluctant to use the name on description. How about you use the Suggested-by tag as following?
[julia.lawall : Suggest that it is not necessary to check return value of platform_get_resource]
Thanks,
Chanwoo Choi
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 8 lines · Chanwoo Choi
Quoted 6 lines · Dan Carpenter
Quoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly.
This really is normal. I've been mentioned over 100 times in commit messages like
7051924f771(xillybus: Move out of staging).
Quoted 6 lines
I'm still reluctant to use the name on description. How about you use the Suggested-by tag as following?
[julia.lawall : Suggest that it is not necessary to check return value of
platform_get_resource]Suggested-by Julia Lawall <[email protected]>
Like Dan, I really don't see the problem. The text in [ ] looks ugly. A suggested by by itself would not be appropriate, since I didn't identify the original issue. There are ther patches that refer to peoples' comments in a similar way. Example:d8aacd87180141ff6b812b53de77a4336e87c91a
julia
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
In reply to Chanwoo ChoiQuoted 9 lines · Chanwoo Choi
Quoted 6 lines · Dan Carpenter
Quoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly.
This really is normal. I've been mentioned over 100 times in commit messages like
7051924f771(xillybus: Move out of staging).I'm still reluctant to use the name on description.
I understand that but I don't understand why, though. Anyway, aren't forwarding this to someone? You can change it to say whatever you want.
regards,
dan carpenter
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Chanwoo Choi
Quoted 4 lines · Dan Carpenter
Quoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
This really is normal. I've been mentioned over 100 times in commit messages like
7051924f771(xillybus: Move out of staging).I'm still reluctant to use the name on description.
I understand that but I don't understand why, though. Anyway, aren't forwarding this to someone? You can change it to say whatever you want.
Because if the name without any unique email address is included in the description,
I think that it is not appropriate. Always, the information should include the email address.
So, I just prefer to use the Suggested-by or the different kind of tag with [id: explanation].
But, I'll stop about it because it is not critical issue. It depend on what is the preferred method to add the information.
Thanks,
Chanwoo Choi
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Quoted 11 lines · Chanwoo Choi
Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Chanwoo Choi
Quoted 6 lines · Dan Carpenter
Quoted 2 lines · Chanwoo Choi
I don't recommend that you mention the name of engineer on patch description directly.
This really is normal. I've been mentioned over 100 times in commit messages like
7051924f771(xillybus: Move out of staging).
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
I'm still reluctant to use the name on description.
I understand that but I don't understand why, though. Anyway, aren't forwarding this to someone? You can change it to say whatever you want.
Because if the name without any unique email address is included in the description,
I sent a Reviewed-by, so this issue is solved.
julia
Quoted 15 lines
I think that it is not appropriate. Always, the information should include the email address.
So, I just prefer to use the Suggested-by or the different kind of tag with [id: explanation].But, I'll stop about it because it is not critical issue. It depend on what is the preferred method to add the information.
Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
In reply to Chanwoo ChoiThe only duplicates that I know about currently are Dan Williams and Xi Wang. I do sometimes get those people mixed up. I hope someday there will be another Julia Lawall duplicate as well. :)
regards,
dan carpenter
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
In reply to Dan CarpenterQuoted 28 lines · Dan Carpenter
Smatch complains because
platform_get_resource()returns NULL on error and not an error pointer so the check is wrong. Julia Lawall pointed out that normally we don't check these, becausedevm_ioremap_resource()has a check for NULL.Signed-off-by Dan Carpenter <[email protected]>---
v2: just remove the checkdrivers/devfreq/event/exynos-nocp.c +0
-4@@ -220,9 +220,6 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); - base =devm_ioremap_resource (dev, res);if (IS_ERR (base))return PTR_ERR (base); --To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
In reply to Dan CarpenterQuoted 6 lines · Dan Carpenter
Smatch complains because
platform_get_resource()returns NULL on error and not an error pointer so the check is wrong. Julia Lawall pointed out that normally we don't check these, becausedevm_ioremap_resource()has a check for NULL.Signed-off-by Dan Carpenter <[email protected]>
Queued in fixes branch to be sent with other fixes for RCx.
Quoted 21 lines
---
v2: just remove the checkdrivers/devfreq/event/exynos-nocp.c +0
-4@@ -220,9 +220,6 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,/* Maps the memory mapped IO to control nocp register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); - base =devm_ioremap_resource (dev, res);if (IS_ERR (base))return PTR_ERR (base); --To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
MyungJoo Ham, Ph.D. Frontier CS Lab, S/W Center, Samsung Electronics
Re: [patch v2] PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Hi Myungjoo,
Quoted 11 lines · MyungJoo Ham
Quoted 6 lines · Dan Carpenter
Smatch complains because
platform_get_resource()returns NULL on error and not an error pointer so the check is wrong. Julia Lawall pointed out that normally we don't check these, becausedevm_ioremap_resource()has a check for NULL.Signed-off-by Dan Carpenter <[email protected]>Acked-by MyungJoo Ham <[email protected]>Queued in fixes branch to be sent with other fixes for RCx.
I already reviewed this patch. Also, the merged patch[1] don't include the my reviewed-by tag.
I'd like you to add my reviewed-by tag again.
Regards,
Chanwoo Choi