All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: mmio: remove some dead code
@ 2019-05-15  9:34 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-05-15  9:34 UTC (permalink / raw)
  To: Talel Shenhar
  Cc: Zhang Rui, Eduardo Valentin, Daniel Lezcano, linux-pm, kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/thermal/thermal_mmio.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
index de3cceea23bc..40524fa13533 100644
--- a/drivers/thermal/thermal_mmio.c
+++ b/drivers/thermal/thermal_mmio.c
@@ -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",
-- 
2.20.1

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

* [PATCH] thermal: mmio: remove some dead code
@ 2019-05-15  9:34 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-05-15  9:34 UTC (permalink / raw)
  To: Talel Shenhar
  Cc: Zhang Rui, Eduardo Valentin, Daniel Lezcano, linux-pm, kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/thermal/thermal_mmio.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
index de3cceea23bc..40524fa13533 100644
--- a/drivers/thermal/thermal_mmio.c
+++ b/drivers/thermal/thermal_mmio.c
@@ -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",
-- 
2.20.1

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

* Re: [PATCH] thermal: mmio: remove some dead code
  2019-05-15  9:34 ` Dan Carpenter
@ 2019-05-20 14:26   ` Shenhar, Talel
  -1 siblings, 0 replies; 8+ messages in thread
From: Shenhar, Talel @ 2019-05-20 14:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Zhang Rui, Eduardo Valentin, Daniel Lezcano, linux-pm, kernel-janitors


On 5/15/2019 12:34 PM, Dan Carpenter wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Talel Shenhar <talel@amazon.com>
> ---
>   drivers/thermal/thermal_mmio.c | 7 -------
>   1 file changed, 7 deletions(-)
>
> diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
> index de3cceea23bc..40524fa13533 100644
> --- a/drivers/thermal/thermal_mmio.c
> +++ b/drivers/thermal/thermal_mmio.c
> @@ -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",

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

* Re: [PATCH] thermal: mmio: remove some dead code
@ 2019-05-20 14:26   ` Shenhar, Talel
  0 siblings, 0 replies; 8+ messages in thread
From: Shenhar, Talel @ 2019-05-20 14:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Zhang Rui, Eduardo Valentin, Daniel Lezcano, linux-pm, kernel-janitors


On 5/15/2019 12:34 PM, Dan Carpenter wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Talel Shenhar <talel@amazon.com>
> ---
>   drivers/thermal/thermal_mmio.c | 7 -------
>   1 file changed, 7 deletions(-)
>
> diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
> index de3cceea23bc..40524fa13533 100644
> --- a/drivers/thermal/thermal_mmio.c
> +++ b/drivers/thermal/thermal_mmio.c
> @@ -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",

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

* Re: [PATCH] thermal: mmio: remove some dead code
  2019-05-20 14:26   ` Shenhar, Talel
@ 2019-06-03  2:09     ` Eduardo Valentin
  -1 siblings, 0 replies; 8+ messages in thread
From: Eduardo Valentin @ 2019-06-03  2:09 UTC (permalink / raw)
  To: Shenhar, Talel
  Cc: Dan Carpenter, Zhang Rui, Daniel Lezcano, linux-pm, kernel-janitors

hey Dan, Talel,

On Mon, May 20, 2019 at 05:26:51PM +0300, Shenhar, Talel wrote:
> 
> On 5/15/2019 12:34 PM, Dan Carpenter wrote:
> >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.
> >
> >Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Talel Shenhar <talel@amazon.com>

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.


> >---
> >  drivers/thermal/thermal_mmio.c | 7 -------
> >  1 file changed, 7 deletions(-)
> >
> >diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
> >index de3cceea23bc..40524fa13533 100644
> >--- a/drivers/thermal/thermal_mmio.c
> >+++ b/drivers/thermal/thermal_mmio.c
> >@@ -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",

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

* Re: [PATCH] thermal: mmio: remove some dead code
@ 2019-06-03  2:09     ` Eduardo Valentin
  0 siblings, 0 replies; 8+ messages in thread
From: Eduardo Valentin @ 2019-06-03  2:09 UTC (permalink / raw)
  To: Shenhar, Talel
  Cc: Dan Carpenter, Zhang Rui, Daniel Lezcano, linux-pm, kernel-janitors

hey Dan, Talel,

On Mon, May 20, 2019 at 05:26:51PM +0300, Shenhar, Talel wrote:
> 
> On 5/15/2019 12:34 PM, Dan Carpenter wrote:
> >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.
> >
> >Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Talel Shenhar <talel@amazon.com>

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.


> >---
> >  drivers/thermal/thermal_mmio.c | 7 -------
> >  1 file changed, 7 deletions(-)
> >
> >diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
> >index de3cceea23bc..40524fa13533 100644
> >--- a/drivers/thermal/thermal_mmio.c
> >+++ b/drivers/thermal/thermal_mmio.c
> >@@ -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",

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

* Re: [PATCH] thermal: mmio: remove some dead code
  2019-06-03  2:09     ` Eduardo Valentin
@ 2019-06-03 10:51       ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-06-03 10:51 UTC (permalink / raw)
  To: Eduardo Valentin
  Cc: Shenhar, Talel, Zhang Rui, Daniel Lezcano, linux-pm, kernel-janitors

On Sun, Jun 02, 2019 at 07:09:03PM -0700, Eduardo Valentin wrote:
> hey Dan, Talel,
> 
> On Mon, May 20, 2019 at 05:26:51PM +0300, Shenhar, Talel wrote:
> > 
> > On 5/15/2019 12:34 PM, Dan Carpenter wrote:
> > >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.
> > >
> > >Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Acked-by: Talel Shenhar <talel@amazon.com>
> 
> 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

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

* Re: [PATCH] thermal: mmio: remove some dead code
@ 2019-06-03 10:51       ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-06-03 10:51 UTC (permalink / raw)
  To: Eduardo Valentin
  Cc: Shenhar, Talel, Zhang Rui, Daniel Lezcano, linux-pm, kernel-janitors

On Sun, Jun 02, 2019 at 07:09:03PM -0700, Eduardo Valentin wrote:
> hey Dan, Talel,
> 
> On Mon, May 20, 2019 at 05:26:51PM +0300, Shenhar, Talel wrote:
> > 
> > On 5/15/2019 12:34 PM, Dan Carpenter wrote:
> > >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.
> > >
> > >Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Acked-by: Talel Shenhar <talel@amazon.com>
> 
> 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


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

end of thread, other threads:[~2019-06-03 10:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15  9:34 [PATCH] thermal: mmio: remove some dead code Dan Carpenter
2019-05-15  9:34 ` Dan Carpenter
2019-05-20 14:26 ` Shenhar, Talel
2019-05-20 14:26   ` Shenhar, Talel
2019-06-03  2:09   ` Eduardo Valentin
2019-06-03  2:09     ` Eduardo Valentin
2019-06-03 10:51     ` Dan Carpenter
2019-06-03 10:51       ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.