diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2007-10-16 04:29:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:19 -0400 |
commit | 53ee1b5bbf937be29862ae8b3ea13af444af1f36 (patch) | |
tree | 3128ad654075f9d7c3368eea0bd15a09eeca73e1 /drivers/video/pmag-ba-fb.c | |
parent | 0b693eafc4be2bc9fceb318501930c66f38dbb10 (diff) |
drivers/video/pmag-ba-fb.c: improve diagnostics
Add error messages to the probe call.
While they may rarely trigger, they may be useful when something weird is
going on. Also this is good style.
[akpm@linux-foundation.org: remove unneeded initialisation]
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/pmag-ba-fb.c')
-rw-r--r-- | drivers/video/pmag-ba-fb.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c index 264d37243fad..3a3f80f65219 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/pmag-ba-fb.c | |||
@@ -147,16 +147,23 @@ static int __init pmagbafb_probe(struct device *dev) | |||
147 | resource_size_t start, len; | 147 | resource_size_t start, len; |
148 | struct fb_info *info; | 148 | struct fb_info *info; |
149 | struct pmagbafb_par *par; | 149 | struct pmagbafb_par *par; |
150 | int err; | ||
150 | 151 | ||
151 | info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev); | 152 | info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev); |
152 | if (!info) | 153 | if (!info) { |
154 | printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id); | ||
153 | return -ENOMEM; | 155 | return -ENOMEM; |
156 | } | ||
154 | 157 | ||
155 | par = info->par; | 158 | par = info->par; |
156 | dev_set_drvdata(dev, info); | 159 | dev_set_drvdata(dev, info); |
157 | 160 | ||
158 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) | 161 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
162 | printk(KERN_ERR "%s: Cannot allocate color map\n", | ||
163 | dev->bus_id); | ||
164 | err = -ENOMEM; | ||
159 | goto err_alloc; | 165 | goto err_alloc; |
166 | } | ||
160 | 167 | ||
161 | info->fbops = &pmagbafb_ops; | 168 | info->fbops = &pmagbafb_ops; |
162 | info->fix = pmagbafb_fix; | 169 | info->fix = pmagbafb_fix; |
@@ -166,28 +173,41 @@ static int __init pmagbafb_probe(struct device *dev) | |||
166 | /* Request the I/O MEM resource. */ | 173 | /* Request the I/O MEM resource. */ |
167 | start = tdev->resource.start; | 174 | start = tdev->resource.start; |
168 | len = tdev->resource.end - start + 1; | 175 | len = tdev->resource.end - start + 1; |
169 | if (!request_mem_region(start, len, dev->bus_id)) | 176 | if (!request_mem_region(start, len, dev->bus_id)) { |
177 | printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); | ||
178 | err = -EBUSY; | ||
170 | goto err_cmap; | 179 | goto err_cmap; |
180 | } | ||
171 | 181 | ||
172 | /* MMIO mapping setup. */ | 182 | /* MMIO mapping setup. */ |
173 | info->fix.mmio_start = start; | 183 | info->fix.mmio_start = start; |
174 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); | 184 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); |
175 | if (!par->mmio) | 185 | if (!par->mmio) { |
186 | printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); | ||
187 | err = -ENOMEM; | ||
176 | goto err_resource; | 188 | goto err_resource; |
189 | } | ||
177 | par->dac = par->mmio + PMAG_BA_BT459; | 190 | par->dac = par->mmio + PMAG_BA_BT459; |
178 | 191 | ||
179 | /* Frame buffer mapping setup. */ | 192 | /* Frame buffer mapping setup. */ |
180 | info->fix.smem_start = start + PMAG_BA_FBMEM; | 193 | info->fix.smem_start = start + PMAG_BA_FBMEM; |
181 | info->screen_base = ioremap_nocache(info->fix.smem_start, | 194 | info->screen_base = ioremap_nocache(info->fix.smem_start, |
182 | info->fix.smem_len); | 195 | info->fix.smem_len); |
183 | if (!info->screen_base) | 196 | if (!info->screen_base) { |
197 | printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); | ||
198 | err = -ENOMEM; | ||
184 | goto err_mmio_map; | 199 | goto err_mmio_map; |
200 | } | ||
185 | info->screen_size = info->fix.smem_len; | 201 | info->screen_size = info->fix.smem_len; |
186 | 202 | ||
187 | pmagbafb_erase_cursor(info); | 203 | pmagbafb_erase_cursor(info); |
188 | 204 | ||
189 | if (register_framebuffer(info) < 0) | 205 | err = register_framebuffer(info); |
206 | if (err < 0) { | ||
207 | printk(KERN_ERR "%s: Cannot register framebuffer\n", | ||
208 | dev->bus_id); | ||
190 | goto err_smem_map; | 209 | goto err_smem_map; |
210 | } | ||
191 | 211 | ||
192 | get_device(dev); | 212 | get_device(dev); |
193 | 213 | ||
@@ -211,7 +231,7 @@ err_cmap: | |||
211 | 231 | ||
212 | err_alloc: | 232 | err_alloc: |
213 | framebuffer_release(info); | 233 | framebuffer_release(info); |
214 | return -ENXIO; | 234 | return err; |
215 | } | 235 | } |
216 | 236 | ||
217 | static int __exit pmagbafb_remove(struct device *dev) | 237 | static int __exit pmagbafb_remove(struct device *dev) |