Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Maciej W. Rozycki and committed by
Linus Torvalds
53ee1b5b 0b693eaf

+27 -7
+27 -7
drivers/video/pmag-ba-fb.c
··· 147 147 resource_size_t start, len; 148 148 struct fb_info *info; 149 149 struct pmagbafb_par *par; 150 + int err; 150 151 151 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 155 return -ENOMEM; 156 + } 154 157 155 158 par = info->par; 156 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 165 goto err_alloc; 166 + } 160 167 161 168 info->fbops = &pmagbafb_ops; 162 169 info->fix = pmagbafb_fix; ··· 173 166 /* Request the I/O MEM resource. */ 174 167 start = tdev->resource.start; 175 168 len = tdev->resource.end - start + 1; 176 - if (!request_mem_region(start, len, dev->bus_id)) 169 + if (!request_mem_region(start, len, dev->bus_id)) { 170 + printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); 171 + err = -EBUSY; 177 172 goto err_cmap; 173 + } 178 174 179 175 /* MMIO mapping setup. */ 180 176 info->fix.mmio_start = start; 181 177 par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); 182 - if (!par->mmio) 178 + if (!par->mmio) { 179 + printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); 180 + err = -ENOMEM; 183 181 goto err_resource; 182 + } 184 183 par->dac = par->mmio + PMAG_BA_BT459; 185 184 186 185 /* Frame buffer mapping setup. */ 187 186 info->fix.smem_start = start + PMAG_BA_FBMEM; 188 187 info->screen_base = ioremap_nocache(info->fix.smem_start, 189 188 info->fix.smem_len); 190 - if (!info->screen_base) 189 + if (!info->screen_base) { 190 + printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); 191 + err = -ENOMEM; 191 192 goto err_mmio_map; 193 + } 192 194 info->screen_size = info->fix.smem_len; 193 195 194 196 pmagbafb_erase_cursor(info); 195 197 196 - if (register_framebuffer(info) < 0) 198 + err = register_framebuffer(info); 199 + if (err < 0) { 200 + printk(KERN_ERR "%s: Cannot register framebuffer\n", 201 + dev->bus_id); 197 202 goto err_smem_map; 203 + } 198 204 199 205 get_device(dev); 200 206 ··· 231 211 232 212 err_alloc: 233 213 framebuffer_release(info); 234 - return -ENXIO; 214 + return err; 235 215 } 236 216 237 217 static int __exit pmagbafb_remove(struct device *dev)