diff options
author | Zhang Rui <rui.zhang@intel.com> | 2013-05-15 22:16:20 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2013-05-20 11:36:18 -0400 |
commit | 253e3ae170d0852620dd9898807a22401d831dc4 (patch) | |
tree | c4f59b0b4c7f4ba4693374ee2455c721ab6444df | |
parent | c28f692c6f5a836dc628fb6990fb4d3d1859f779 (diff) |
Thermal: spear_thermal: convert to devm_ioremap_resource
Use the newly introduced devm_ioremap_resource().
devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.
CC: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r-- | drivers/thermal/spear_thermal.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 3c5ee5607977..b9e21611aece 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c | |||
@@ -104,7 +104,7 @@ static int spear_thermal_probe(struct platform_device *pdev) | |||
104 | struct thermal_zone_device *spear_thermal = NULL; | 104 | struct thermal_zone_device *spear_thermal = NULL; |
105 | struct spear_thermal_dev *stdev; | 105 | struct spear_thermal_dev *stdev; |
106 | struct device_node *np = pdev->dev.of_node; | 106 | struct device_node *np = pdev->dev.of_node; |
107 | struct resource *stres = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 107 | struct resource *res; |
108 | int ret = 0, val; | 108 | int ret = 0, val; |
109 | 109 | ||
110 | if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) { | 110 | if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) { |
@@ -112,23 +112,23 @@ static int spear_thermal_probe(struct platform_device *pdev) | |||
112 | return -EINVAL; | 112 | return -EINVAL; |
113 | } | 113 | } |
114 | 114 | ||
115 | if (!stres) { | ||
116 | dev_err(&pdev->dev, "memory resource missing\n"); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL); | 115 | stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL); |
121 | if (!stdev) { | 116 | if (!stdev) { |
122 | dev_err(&pdev->dev, "kzalloc fail\n"); | 117 | dev_err(&pdev->dev, "kzalloc fail\n"); |
123 | return -ENOMEM; | 118 | return -ENOMEM; |
124 | } | 119 | } |
125 | 120 | ||
121 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
122 | if (!res) { | ||
123 | dev_err(&pdev->dev, "memory resource missing\n"); | ||
124 | return -ENODEV; | ||
125 | } | ||
126 | |||
126 | /* Enable thermal sensor */ | 127 | /* Enable thermal sensor */ |
127 | stdev->thermal_base = devm_ioremap(&pdev->dev, stres->start, | 128 | stdev->thermal_base = devm_ioremap_resource(dev, res); |
128 | resource_size(stres)); | 129 | if (IS_ERR(stdev->thermal_base)) { |
129 | if (!stdev->thermal_base) { | ||
130 | dev_err(&pdev->dev, "ioremap failed\n"); | 130 | dev_err(&pdev->dev, "ioremap failed\n"); |
131 | return -ENOMEM; | 131 | return PTR_ERR(stdev->thermal_base); |
132 | } | 132 | } |
133 | 133 | ||
134 | stdev->clk = devm_clk_get(&pdev->dev, NULL); | 134 | stdev->clk = devm_clk_get(&pdev->dev, NULL); |