Skip to contentSkip to conversation

thermal: qoriq: Remove unnecessary platform_set_drvdata()

PATCH In review Wei Yongjun 3 participants 3 messages Aug 23, 2016 – Sep 8, 2016 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: qoriq: Remove unnecessary platform_set_drvdata()

From: Wei Yongjun <[email protected]>

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/thermal/qoriq_thermal.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/thermal/qoriq_thermal.c +2 -8
index 644ba52..d01eca0 100644
@@ -217,15 +217,13 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 	data->sensor_id = qoriq_tmu_get_sensor_id();
 	if (data->sensor_id < 0) {
 		dev_err(&pdev->dev, "Failed to get sensor id\n");
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;
 	}
 
 	data->regs = of_iomap(np, 0);
 	if (!data->regs) {
 		dev_err(&pdev->dev, "Failed to get memory region\n");
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;
 	}
 
 	qoriq_tmu_init_device(data);	/* TMU initialization */
@@ -254,9 +252,6 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 err_tmu:
 	iounmap(data->regs);
 
-err_iomap:
-	platform_set_drvdata(pdev, NULL);
-
 	return ret;
 }
 
@@ -270,7 +265,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
 	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
 
 	iounmap(data->regs);
-	platform_set_drvdata(pdev, NULL);
 
 	return 0;
 }
reviewer
#1 lore raw
Quoted 7 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

Patch applied.

thanks,
rui

Quoted 52 lines

---
 drivers/thermal/qoriq_thermal.c | 10 ++--------

 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/thermal/qoriq_thermal.c +1 -2
index 644ba52..d01eca0 100644
@@ -217,15 +217,13 @@ static int qoriq_tmu_probe(struct
 platform_device *pdev)
  	data->sensor_id = qoriq_tmu_get_sensor_id();
  	if (data->sensor_id < 0) {
  		dev_err(&pdev->dev, "Failed to get sensor id\n");
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;
  	}


  data->regs = of_iomap(np, 0);
  if (!data->regs) {
  dev_err(&pdev->dev, "Failed to get memory region\n");

drivers/thermal/qoriq_thermal.c +1 -2
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;

  }

  qoriq_tmu_init_device(data); /* TMU initialization */

drivers/thermal/qoriq_thermal.c +0 -0
@@ -254,9 +252,6 @@ static int qoriq_tmu_probe(struct platform_device
 *pdev)

 err_tmu:
  iounmap(data->regs);

drivers/thermal/qoriq_thermal.c +0 -3
-err_iomap:
-	platform_set_drvdata(pdev, NULL);
-

  return ret;
 }

drivers/thermal/qoriq_thermal.c +0 -0
@@ -270,7 +265,6 @@ static int qoriq_tmu_remove(struct
 platform_device *pdev)
  	tmu_write(data, TMR_DISABLE, &data->regs->tmr);


  iounmap(data->regs);

drivers/thermal/qoriq_thermal.c +0 -1
-	platform_set_drvdata(pdev, NULL);


  return 0;
 }

#2 lore raw
Quoted 19 lines

-----Original Message-----
From: Zhang Rui [mailto:[email protected]]
Sent: Wednesday, August 24, 2016 2:41 PM
To: Wei Yongjun <[email protected]>; Eduardo Valentin <[email protected]>
Cc: Wei Yongjun <[email protected]>; [email protected]; Hongtao Jia <[email protected]>
Subject: Re: [PATCH -next] thermal: qoriq: Remove unnecessary platform_set_drvdata()

Quoted 6 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

Quoted 6 lines
Quoted 1 line

Patch applied.

thanks,
rui

Thanks Yongjun for the fix.

Quoted 52 lines
Quoted 52 lines

---
 drivers/thermal/qoriq_thermal.c | 10 ++--------

 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/thermal/qoriq_thermal.c +1 -2
index 644ba52..d01eca0 100644
@@ -217,15 +217,13 @@ static int qoriq_tmu_probe(struct
 platform_device *pdev)
  	data->sensor_id = qoriq_tmu_get_sensor_id();
  	if (data->sensor_id < 0) {
  		dev_err(&pdev->dev, "Failed to get sensor id\n");
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;
  	}
 
  	data->regs = of_iomap(np, 0);
  	if (!data->regs) {

  dev_err(&pdev->dev, "Failed to get memory region\n");

drivers/thermal/qoriq_thermal.c +1 -2
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;

  }

  qoriq_tmu_init_device(data); /* TMU initialization */

drivers/thermal/qoriq_thermal.c +0 -0
@@ -254,9 +252,6 @@ static int qoriq_tmu_probe(struct platform_device
 *pdev)

 err_tmu:
  iounmap(data->regs);

drivers/thermal/qoriq_thermal.c +0 -3
-err_iomap:
-	platform_set_drvdata(pdev, NULL);
-

  return ret;
 }

drivers/thermal/qoriq_thermal.c +0 -1
@@ -270,7 +265,6 @@ static int qoriq_tmu_remove(struct
 platform_device *pdev)
  	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
 
  	iounmap(data->regs);
-	platform_set_drvdata(pdev, NULL);
 
  	return 0;

 }