thermal: qoriq: Remove unnecessary platform_set_drvdata()
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
@@ -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 ; }
Zhang Rui
reviewerQuoted 7 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
The driver core clears the driver data to NULL after
device_releaseor on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.Signed-off-by Wei Yongjun <[email protected]>
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@@ -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;
}
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 unnecessaryplatform_set_drvdata()Quoted 6 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
The driver core clears the driver data to NULL after
device_releaseor on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.
Quoted 6 lines
Quoted 1 line
Signed-off-by Wei Yongjun <[email protected]>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@@ -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;}