Skip to content

Commit 1855350

Browse files
committed
Merge tag 'fbdev-for-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev fixes and cleanups from Helge Deller: - fix double free and resource leaks in imsttfb - lots of remove callback cleanups and section mismatch fixes in omapfb, amifb and atmel_lcdfb - error code fix and memparse simplification in omapfb * tag 'fbdev-for-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: (31 commits) fbdev: fsl-diu-fb: mark wr_reg_wa() static fbdev: amifb: Convert to platform remove callback returning void fbdev: amifb: Mark driver struct with __refdata to prevent section mismatch warning fbdev: hyperv_fb: fix uninitialized local variable use fbdev: omapfb/tpd12s015: Convert to platform remove callback returning void fbdev: omapfb/tfp410: Convert to platform remove callback returning void fbdev: omapfb/sharp-ls037v7dw01: Convert to platform remove callback returning void fbdev: omapfb/opa362: Convert to platform remove callback returning void fbdev: omapfb/hdmi: Convert to platform remove callback returning void fbdev: omapfb/dvi: Convert to platform remove callback returning void fbdev: omapfb/dsi-cm: Convert to platform remove callback returning void fbdev: omapfb/dpi: Convert to platform remove callback returning void fbdev: omapfb/analog-tv: Convert to platform remove callback returning void fbdev: atmel_lcdfb: Convert to platform remove callback returning void fbdev: omapfb/tpd12s015: Don't put .remove() in .exit.text and drop suppress_bind_attrs fbdev: omapfb/tfp410: Don't put .remove() in .exit.text and drop suppress_bind_attrs fbdev: omapfb/sharp-ls037v7dw01: Don't put .remove() in .exit.text and drop suppress_bind_attrs fbdev: omapfb/opa362: Don't put .remove() in .exit.text and drop suppress_bind_attrs fbdev: omapfb/hdmi: Don't put .remove() in .exit.text and drop suppress_bind_attrs fbdev: omapfb/dvi: Don't put .remove() in .exit.text and drop suppress_bind_attrs ...
2 parents c0d12d7 + a5035c8 commit 1855350

18 files changed

+70
-110
lines changed

drivers/video/fbdev/amifb.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,7 +3752,7 @@ static int __init amifb_probe(struct platform_device *pdev)
37523752
}
37533753

37543754

3755-
static int __exit amifb_remove(struct platform_device *pdev)
3755+
static void __exit amifb_remove(struct platform_device *pdev)
37563756
{
37573757
struct fb_info *info = platform_get_drvdata(pdev);
37583758

@@ -3765,11 +3765,16 @@ static int __exit amifb_remove(struct platform_device *pdev)
37653765
chipfree();
37663766
framebuffer_release(info);
37673767
amifb_video_off();
3768-
return 0;
37693768
}
37703769

3771-
static struct platform_driver amifb_driver = {
3772-
.remove = __exit_p(amifb_remove),
3770+
/*
3771+
* amifb_remove() lives in .exit.text. For drivers registered via
3772+
* module_platform_driver_probe() this ok because they cannot get unboud at
3773+
* runtime. The driver needs to be marked with __refdata, otherwise modpost
3774+
* triggers a section mismatch warning.
3775+
*/
3776+
static struct platform_driver amifb_driver __refdata = {
3777+
.remove_new = __exit_p(amifb_remove),
37733778
.driver = {
37743779
.name = "amiga-video",
37753780
},

drivers/video/fbdev/atmel_lcdfb.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int
220220
}
221221
}
222222

223-
static const struct fb_fix_screeninfo atmel_lcdfb_fix __initconst = {
223+
static const struct fb_fix_screeninfo atmel_lcdfb_fix = {
224224
.type = FB_TYPE_PACKED_PIXELS,
225225
.visual = FB_VISUAL_TRUECOLOR,
226226
.xpanstep = 0,
@@ -841,7 +841,7 @@ static void atmel_lcdfb_task(struct work_struct *work)
841841
atmel_lcdfb_reset(sinfo);
842842
}
843843

844-
static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
844+
static int atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
845845
{
846846
struct fb_info *info = sinfo->info;
847847
int ret = 0;
@@ -1017,7 +1017,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
10171017
return ret;
10181018
}
10191019

1020-
static int __init atmel_lcdfb_probe(struct platform_device *pdev)
1020+
static int atmel_lcdfb_probe(struct platform_device *pdev)
10211021
{
10221022
struct device *dev = &pdev->dev;
10231023
struct fb_info *info;
@@ -1223,14 +1223,14 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
12231223
return ret;
12241224
}
12251225

1226-
static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
1226+
static void atmel_lcdfb_remove(struct platform_device *pdev)
12271227
{
12281228
struct device *dev = &pdev->dev;
12291229
struct fb_info *info = dev_get_drvdata(dev);
12301230
struct atmel_lcdfb_info *sinfo;
12311231

12321232
if (!info || !info->par)
1233-
return 0;
1233+
return;
12341234
sinfo = info->par;
12351235

12361236
cancel_work_sync(&sinfo->task);
@@ -1252,8 +1252,6 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
12521252
}
12531253

12541254
framebuffer_release(info);
1255-
1256-
return 0;
12571255
}
12581256

12591257
#ifdef CONFIG_PM
@@ -1301,16 +1299,16 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
13011299
#endif
13021300

13031301
static struct platform_driver atmel_lcdfb_driver = {
1304-
.remove = __exit_p(atmel_lcdfb_remove),
1302+
.probe = atmel_lcdfb_probe,
1303+
.remove_new = atmel_lcdfb_remove,
13051304
.suspend = atmel_lcdfb_suspend,
13061305
.resume = atmel_lcdfb_resume,
13071306
.driver = {
13081307
.name = "atmel_lcdfb",
13091308
.of_match_table = atmel_lcdfb_dt_ids,
13101309
},
13111310
};
1312-
1313-
module_platform_driver_probe(atmel_lcdfb_driver, atmel_lcdfb_probe);
1311+
module_platform_driver(atmel_lcdfb_driver);
13141312

13151313
MODULE_DESCRIPTION("AT91 LCD Controller framebuffer driver");
13161314
MODULE_AUTHOR("Nicolas Ferre <[email protected]>");

drivers/video/fbdev/fsl-diu-fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)
490490
* Workaround for failed writing desc register of planes.
491491
* Needed with MPC5121 DIU rev 2.0 silicon.
492492
*/
493-
void wr_reg_wa(u32 *reg, u32 val)
493+
static void wr_reg_wa(u32 *reg, u32 val)
494494
{
495495
do {
496496
out_be32(reg, val);

drivers/video/fbdev/hyperv_fb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
10131013
} else if (IS_ENABLED(CONFIG_SYSFB)) {
10141014
base = screen_info.lfb_base;
10151015
size = screen_info.lfb_size;
1016+
} else {
1017+
goto err1;
10161018
}
10171019

10181020
/*

drivers/video/fbdev/imsttfb.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,6 @@ static int init_imstt(struct fb_info *info)
14211421
if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len
14221422
|| !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) {
14231423
printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pixel);
1424-
framebuffer_release(info);
14251424
return -ENODEV;
14261425
}
14271426

@@ -1453,14 +1452,11 @@ static int init_imstt(struct fb_info *info)
14531452
FBINFO_HWACCEL_FILLRECT |
14541453
FBINFO_HWACCEL_YPAN;
14551454

1456-
if (fb_alloc_cmap(&info->cmap, 0, 0)) {
1457-
framebuffer_release(info);
1455+
if (fb_alloc_cmap(&info->cmap, 0, 0))
14581456
return -ENODEV;
1459-
}
14601457

14611458
if (register_framebuffer(info) < 0) {
14621459
fb_dealloc_cmap(&info->cmap);
1463-
framebuffer_release(info);
14641460
return -ENODEV;
14651461
}
14661462

@@ -1500,8 +1496,8 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
15001496

15011497
if (!request_mem_region(addr, size, "imsttfb")) {
15021498
printk(KERN_ERR "imsttfb: Can't reserve memory region\n");
1503-
framebuffer_release(info);
1504-
return -ENODEV;
1499+
ret = -ENODEV;
1500+
goto release_info;
15051501
}
15061502

15071503
switch (pdev->device) {
@@ -1518,36 +1514,39 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
15181514
printk(KERN_INFO "imsttfb: Device 0x%x unknown, "
15191515
"contact maintainer.\n", pdev->device);
15201516
ret = -ENODEV;
1521-
goto error;
1517+
goto release_mem_region;
15221518
}
15231519

15241520
info->fix.smem_start = addr;
15251521
info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ?
15261522
0x400000 : 0x800000);
15271523
if (!info->screen_base)
1528-
goto error;
1524+
goto release_mem_region;
15291525
info->fix.mmio_start = addr + 0x800000;
15301526
par->dc_regs = ioremap(addr + 0x800000, 0x1000);
15311527
if (!par->dc_regs)
1532-
goto error;
1528+
goto unmap_screen_base;
15331529
par->cmap_regs_phys = addr + 0x840000;
15341530
par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000);
15351531
if (!par->cmap_regs)
1536-
goto error;
1532+
goto unmap_dc_regs;
15371533
info->pseudo_palette = par->palette;
15381534
ret = init_imstt(info);
15391535
if (ret)
1540-
goto error;
1536+
goto unmap_cmap_regs;
15411537

15421538
pci_set_drvdata(pdev, info);
1543-
return ret;
1539+
return 0;
15441540

1545-
error:
1546-
if (par->dc_regs)
1547-
iounmap(par->dc_regs);
1548-
if (info->screen_base)
1549-
iounmap(info->screen_base);
1541+
unmap_cmap_regs:
1542+
iounmap(par->cmap_regs);
1543+
unmap_dc_regs:
1544+
iounmap(par->dc_regs);
1545+
unmap_screen_base:
1546+
iounmap(info->screen_base);
1547+
release_mem_region:
15501548
release_mem_region(addr, size);
1549+
release_info:
15511550
framebuffer_release(info);
15521551
return ret;
15531552
}

drivers/video/fbdev/offb.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,9 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
423423
fix = &info->fix;
424424
var = &info->var;
425425

426-
if (name) {
427-
strcpy(fix->id, "OFfb ");
428-
strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
429-
fix->id[sizeof(fix->id) - 1] = '\0';
430-
} else
426+
if (name)
427+
snprintf(fix->id, sizeof(fix->id), "OFfb %s", name);
428+
else
431429
snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);
432430

433431

drivers/video/fbdev/omap/omapfb_main.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,17 +1643,16 @@ static int omapfb_do_probe(struct platform_device *pdev,
16431643
r = -ENOMEM;
16441644
goto cleanup;
16451645
}
1646-
fbdev->int_irq = platform_get_irq(pdev, 0);
1647-
if (fbdev->int_irq < 0) {
1648-
r = -ENXIO;
1646+
1647+
r = platform_get_irq(pdev, 0);
1648+
if (r < 0)
16491649
goto cleanup;
1650-
}
1650+
fbdev->int_irq = r;
16511651

1652-
fbdev->ext_irq = platform_get_irq(pdev, 1);
1653-
if (fbdev->ext_irq < 0) {
1654-
r = -ENXIO;
1652+
r = platform_get_irq(pdev, 1);
1653+
if (r < 0)
16551654
goto cleanup;
1656-
}
1655+
fbdev->ext_irq = r;
16571656

16581657
init_state++;
16591658

@@ -1857,20 +1856,13 @@ static int __init omapfb_setup(char *options)
18571856
if (!strncmp(this_opt, "accel", 5))
18581857
def_accel = 1;
18591858
else if (!strncmp(this_opt, "vram:", 5)) {
1859+
unsigned long long vram;
18601860
char *suffix;
1861-
unsigned long vram;
1862-
vram = (simple_strtoul(this_opt + 5, &suffix, 0));
1861+
1862+
vram = memparse(this_opt + 5, &suffix);
18631863
switch (suffix[0]) {
18641864
case '\0':
18651865
break;
1866-
case 'm':
1867-
case 'M':
1868-
vram *= 1024;
1869-
fallthrough;
1870-
case 'k':
1871-
case 'K':
1872-
vram *= 1024;
1873-
break;
18741866
default:
18751867
pr_debug("omapfb: invalid vram suffix %c\n",
18761868
suffix[0]);

drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int tvc_probe(struct platform_device *pdev)
221221
return r;
222222
}
223223

224-
static int __exit tvc_remove(struct platform_device *pdev)
224+
static void tvc_remove(struct platform_device *pdev)
225225
{
226226
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
227227
struct omap_dss_device *dssdev = &ddata->dssdev;
@@ -233,8 +233,6 @@ static int __exit tvc_remove(struct platform_device *pdev)
233233
tvc_disconnect(dssdev);
234234

235235
omap_dss_put_device(in);
236-
237-
return 0;
238236
}
239237

240238
static const struct of_device_id tvc_of_match[] = {
@@ -247,11 +245,10 @@ MODULE_DEVICE_TABLE(of, tvc_of_match);
247245

248246
static struct platform_driver tvc_connector_driver = {
249247
.probe = tvc_probe,
250-
.remove = __exit_p(tvc_remove),
248+
.remove_new = tvc_remove,
251249
.driver = {
252250
.name = "connector-analog-tv",
253251
.of_match_table = tvc_of_match,
254-
.suppress_bind_attrs = true,
255252
},
256253
};
257254

drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static int dvic_probe(struct platform_device *pdev)
303303
return r;
304304
}
305305

306-
static int __exit dvic_remove(struct platform_device *pdev)
306+
static void dvic_remove(struct platform_device *pdev)
307307
{
308308
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
309309
struct omap_dss_device *dssdev = &ddata->dssdev;
@@ -317,8 +317,6 @@ static int __exit dvic_remove(struct platform_device *pdev)
317317
omap_dss_put_device(in);
318318

319319
i2c_put_adapter(ddata->i2c_adapter);
320-
321-
return 0;
322320
}
323321

324322
static const struct of_device_id dvic_of_match[] = {
@@ -330,11 +328,10 @@ MODULE_DEVICE_TABLE(of, dvic_of_match);
330328

331329
static struct platform_driver dvi_connector_driver = {
332330
.probe = dvic_probe,
333-
.remove = __exit_p(dvic_remove),
331+
.remove_new = dvic_remove,
334332
.driver = {
335333
.name = "connector-dvi",
336334
.of_match_table = dvic_of_match,
337-
.suppress_bind_attrs = true,
338335
},
339336
};
340337

drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static int hdmic_probe(struct platform_device *pdev)
249249
return r;
250250
}
251251

252-
static int __exit hdmic_remove(struct platform_device *pdev)
252+
static void hdmic_remove(struct platform_device *pdev)
253253
{
254254
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
255255
struct omap_dss_device *dssdev = &ddata->dssdev;
@@ -261,8 +261,6 @@ static int __exit hdmic_remove(struct platform_device *pdev)
261261
hdmic_disconnect(dssdev);
262262

263263
omap_dss_put_device(in);
264-
265-
return 0;
266264
}
267265

268266
static const struct of_device_id hdmic_of_match[] = {
@@ -274,11 +272,10 @@ MODULE_DEVICE_TABLE(of, hdmic_of_match);
274272

275273
static struct platform_driver hdmi_connector_driver = {
276274
.probe = hdmic_probe,
277-
.remove = __exit_p(hdmic_remove),
275+
.remove_new = hdmic_remove,
278276
.driver = {
279277
.name = "connector-hdmi",
280278
.of_match_table = hdmic_of_match,
281-
.suppress_bind_attrs = true,
282279
},
283280
};
284281

drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static int opa362_probe(struct platform_device *pdev)
231231
return r;
232232
}
233233

234-
static int __exit opa362_remove(struct platform_device *pdev)
234+
static void opa362_remove(struct platform_device *pdev)
235235
{
236236
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
237237
struct omap_dss_device *dssdev = &ddata->dssdev;
@@ -248,8 +248,6 @@ static int __exit opa362_remove(struct platform_device *pdev)
248248
opa362_disconnect(dssdev, dssdev->dst);
249249

250250
omap_dss_put_device(in);
251-
252-
return 0;
253251
}
254252

255253
static const struct of_device_id opa362_of_match[] = {
@@ -260,11 +258,10 @@ MODULE_DEVICE_TABLE(of, opa362_of_match);
260258

261259
static struct platform_driver opa362_driver = {
262260
.probe = opa362_probe,
263-
.remove = __exit_p(opa362_remove),
261+
.remove_new = opa362_remove,
264262
.driver = {
265263
.name = "amplifier-opa362",
266264
.of_match_table = opa362_of_match,
267-
.suppress_bind_attrs = true,
268265
},
269266
};
270267

0 commit comments

Comments
 (0)