thermal: mmio: remove some dead code
Subsystems (3)
PATCH 1/1 thermal: mmio: remove some dead code
The platform_get_resource() function doesn't return error pointers, it returns NULL. The way this is normally done, is that we pass the NULL resource to devm_ioremap_resource() and then check for errors from that. See the comment in front of devm_ioremap_resource() for more details.
--- drivers/thermal/thermal_mmio.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/thermal/thermal_mmio.c +0 -7
@@ -53,13 +53,6 @@ static int thermal_mmio_probe(struct platform_device *pdev)return -ENOMEM ; resource =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (resource)) { -dev_err (&pdev->dev, -"fail to get platform memory resource (%ld)\n" , -PTR_ERR (resource)); -return PTR_ERR (resource); - } - sensor->mmio_base =devm_ioremap_resource (&pdev->dev, resource);if (IS_ERR (sensor->mmio_base)) { dev_err(&pdev->dev, "failed to ioremap memory (%ld)\n",
Signature · 1 line
2.20.1
Quoted 6 lines · Dan Carpenter
The
platform_get_resource()function doesn't return error pointers, it returns NULL. The way this is normally done, is that we pass the NULL resource todevm_ioremap_resource()and then check for errors from that. See the comment in front ofdevm_ioremap_resource()for more details.Signed-off-by Dan Carpenter <[email protected]>
Quoted 22 lines
--- drivers/thermal/thermal_mmio.c | 7 ------- 1 file changed, 7 deletions(-)drivers/thermal/thermal_mmio.c +0
-7@@ -53,13 +53,6 @@ static int thermal_mmio_probe(struct platform_device *pdev)return -ENOMEM ; resource =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (resource)) { -dev_err (&pdev->dev, -"fail to get platform memory resource (%ld)\n" , -PTR_ERR (resource)); -return PTR_ERR (resource); - } - sensor->mmio_base =devm_ioremap_resource (&pdev->dev, resource);if (IS_ERR (sensor->mmio_base)) { dev_err(&pdev->dev, "failed to ioremap memory (%ld)\n",
hey Dan, Talel,
Quoted 9 lines · Talel
Quoted 6 lines · Dan Carpenter
The
platform_get_resource()function doesn't return error pointers, it returns NULL. The way this is normally done, is that we pass the NULL resource todevm_ioremap_resource()and then check for errors from that. See the comment in front ofdevm_ioremap_resource()for more details.Signed-off-by Dan Carpenter <[email protected]>Acked-by Talel Shenhar <[email protected]>
Cool. I will be collecting this. The only change I will do while applying this is that the subject will look like this:
"thermal: thermal_mmio: remove some dead code"
Just to match the file / driver name.
Quoted 21 lines
Quoted 21 lines
--- drivers/thermal/thermal_mmio.c | 7 ------- 1 file changed, 7 deletions(-)drivers/thermal/thermal_mmio.c +0
-7@@ -53,13 +53,6 @@ static int thermal_mmio_probe(struct platform_device *pdev)return -ENOMEM ; resource =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (resource)) { -dev_err (&pdev->dev, -"fail to get platform memory resource (%ld)\n" , -PTR_ERR (resource)); -return PTR_ERR (resource); - } - sensor->mmio_base =devm_ioremap_resource (&pdev->dev, resource);if (IS_ERR (sensor->mmio_base)) { dev_err(&pdev->dev, "failed to ioremap memory (%ld)\n",
Quoted 10 lines · Eduardo Valentin
hey Dan, Talel,
Quoted 7 lines · Talel
Quoted 5 lines · Dan Carpenter
The
platform_get_resource()function doesn't return error pointers, it returns NULL. The way this is normally done, is that we pass the NULL resource todevm_ioremap_resource()and then check for errors from that. See the comment in front ofdevm_ioremap_resource()for more details.
Quoted 9 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>Acked-by Talel Shenhar <[email protected]>Cool. I will be collecting this. The only change I will do while applying this is that the subject will look like this:
"thermal:thermal_mmio: remove some dead code"Just to match the file / driver name.
I feel like it's duplicative to have "thermal" twice, but whatever. What I normally do is I copy-and-paste what other people use because the prefered format varies from subsystem to subsystem. Here the only previous patch was:
71aa3693493d thermal: Introduce Amazon's Annapurna Labs Thermal Driver
This format was obviously even worse...
I'm often the first person to send a patch for new drivers. It used to be common for people to not use a correct patch prefix for the patch which adds a driver. But what happened was people got annoyed with the prefixes I chose. And I was like, "Nah. Forget about it. I got here first and I claim this land for my ownself. Be grateful I didn't choose a snide or rude patch prefix because that's my authority as a prefix chooser."
regards,
dan carpenter