[PATCH 4/6] i2c: at91: Fix a possible NULL pointer access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



platform_get_resource uses pdev so move the function
platform_set_drvdata(pdev, NULL) after the get_resource.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@xxxxxx>
---
untested

 drivers/i2c/busses/i2c-at91.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index e24484b..f748e87 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -263,7 +263,6 @@ static int __devexit at91_i2c_remove(struct platform_device *pdev)
 	int rc;
 
 	rc = i2c_del_adapter(adapter);
-	platform_set_drvdata(pdev, NULL);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	iounmap(twi_base);
@@ -271,6 +270,7 @@ static int __devexit at91_i2c_remove(struct platform_device *pdev)
 
 	clk_disable(twi_clk);		/* disable peripheral clock */
 	clk_put(twi_clk);
+	platform_set_drvdata(pdev, NULL);
 
 	return rc;
 }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux