Skip to content

Commit 89b749d

Browse files
committed
Merge tag 'fbdev-for-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev fixes and updates from Helge Deller: "Mostly just small patches, with the exception of the bigger indenting cleanups in the sisfb and radeonfb drivers. Two patches should be mentioned though: A fix-up for fbdev if the screen resize fails (by Shigeru Yoshida), and a potential divide by zero fix in fb_pm2fb (by Letu Ren). Summary: Major fixes: - Revert the changes for fbcon console when vc_resize() fails [Shigeru Yoshida] - Avoid a potential divide by zero error in fb_pm2fb [Letu Ren] Minor fixes: - Add missing pci_disable_device() in chipsfb_pci_init() [Yang Yingliang] - Fix tests for platform_get_irq() failure in omapfb [Yu Zhe] - Destroy mutex on freeing struct fb_info in fbsysfs [Shigeru Yoshida] Cleanups: - Move fbdev drivers from strlcpy to strscpy [Wolfram Sang] - Indenting fixes, comment fixes, ... [Jiapeng Chong & Jilin Yuan]" * tag 'fbdev-for-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: fbdev: fbcon: Properly revert changes when vc_resize() failed fbdev: Move fbdev drivers from strlcpy to strscpy fbdev: omap: Remove unnecessary print function dev_err() fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init() fbdev: fbcon: Destroy mutex on freeing struct fb_info fbdev: radeon: Clean up some inconsistent indenting fbdev: sisfb: Clean up some inconsistent indenting fbdev: fb_pm2fb: Avoid potential divide by zero error fbdev: ssd1307fb: Fix repeated words in comments fbdev: omapfb: Fix tests for platform_get_irq() failure
2 parents d6ffe60 + a5a9230 commit 89b749d

34 files changed

+240
-201
lines changed

drivers/video/console/sticore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static char default_sti_path[21] __read_mostly;
290290
static int __init sti_setup(char *str)
291291
{
292292
if (str)
293-
strlcpy (default_sti_path, str, sizeof (default_sti_path));
293+
strscpy(default_sti_path, str, sizeof(default_sti_path));
294294

295295
return 1;
296296
}

drivers/video/fbdev/aty/atyfb_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3891,7 +3891,7 @@ static int __init atyfb_setup(char *options)
38913891
&& (!strncmp(this_opt, "Mach64:", 7))) {
38923892
static unsigned char m64_num;
38933893
static char mach64_str[80];
3894-
strlcpy(mach64_str, this_opt + 7, sizeof(mach64_str));
3894+
strscpy(mach64_str, this_opt + 7, sizeof(mach64_str));
38953895
if (!store_video_par(mach64_str, m64_num)) {
38963896
m64_num++;
38973897
mach64_count = m64_num;

drivers/video/fbdev/aty/radeon_base.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ static int radeon_set_fbinfo(struct radeonfb_info *rinfo)
19801980
info->screen_base = rinfo->fb_base;
19811981
info->screen_size = rinfo->mapped_vram;
19821982
/* Fill fix common fields */
1983-
strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id));
1983+
strscpy(info->fix.id, rinfo->name, sizeof(info->fix.id));
19841984
info->fix.smem_start = rinfo->fb_base_phys;
19851985
info->fix.smem_len = rinfo->video_ram;
19861986
info->fix.type = FB_TYPE_PACKED_PIXELS;
@@ -2094,34 +2094,34 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo)
20942094
u32 tmp;
20952095

20962096
/* framebuffer size */
2097-
if ((rinfo->family == CHIP_FAMILY_RS100) ||
2097+
if ((rinfo->family == CHIP_FAMILY_RS100) ||
20982098
(rinfo->family == CHIP_FAMILY_RS200) ||
20992099
(rinfo->family == CHIP_FAMILY_RS300) ||
21002100
(rinfo->family == CHIP_FAMILY_RC410) ||
21012101
(rinfo->family == CHIP_FAMILY_RS400) ||
21022102
(rinfo->family == CHIP_FAMILY_RS480) ) {
2103-
u32 tom = INREG(NB_TOM);
2104-
tmp = ((((tom >> 16) - (tom & 0xffff) + 1) << 6) * 1024);
2105-
2106-
radeon_fifo_wait(6);
2107-
OUTREG(MC_FB_LOCATION, tom);
2108-
OUTREG(DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
2109-
OUTREG(CRTC2_DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
2110-
OUTREG(OV0_BASE_ADDR, (tom & 0xffff) << 16);
2111-
2112-
/* This is supposed to fix the crtc2 noise problem. */
2113-
OUTREG(GRPH2_BUFFER_CNTL, INREG(GRPH2_BUFFER_CNTL) & ~0x7f0000);
2114-
2115-
if ((rinfo->family == CHIP_FAMILY_RS100) ||
2116-
(rinfo->family == CHIP_FAMILY_RS200)) {
2117-
/* This is to workaround the asic bug for RMX, some versions
2118-
of BIOS doesn't have this register initialized correctly.
2119-
*/
2120-
OUTREGP(CRTC_MORE_CNTL, CRTC_H_CUTOFF_ACTIVE_EN,
2121-
~CRTC_H_CUTOFF_ACTIVE_EN);
2122-
}
2123-
} else {
2124-
tmp = INREG(CNFG_MEMSIZE);
2103+
u32 tom = INREG(NB_TOM);
2104+
2105+
tmp = ((((tom >> 16) - (tom & 0xffff) + 1) << 6) * 1024);
2106+
radeon_fifo_wait(6);
2107+
OUTREG(MC_FB_LOCATION, tom);
2108+
OUTREG(DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
2109+
OUTREG(CRTC2_DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
2110+
OUTREG(OV0_BASE_ADDR, (tom & 0xffff) << 16);
2111+
2112+
/* This is supposed to fix the crtc2 noise problem. */
2113+
OUTREG(GRPH2_BUFFER_CNTL, INREG(GRPH2_BUFFER_CNTL) & ~0x7f0000);
2114+
2115+
if ((rinfo->family == CHIP_FAMILY_RS100) ||
2116+
(rinfo->family == CHIP_FAMILY_RS200)) {
2117+
/* This is to workaround the asic bug for RMX, some versions
2118+
* of BIOS doesn't have this register initialized correctly.
2119+
*/
2120+
OUTREGP(CRTC_MORE_CNTL, CRTC_H_CUTOFF_ACTIVE_EN,
2121+
~CRTC_H_CUTOFF_ACTIVE_EN);
2122+
}
2123+
} else {
2124+
tmp = INREG(CNFG_MEMSIZE);
21252125
}
21262126

21272127
/* mem size is bits [28:0], mask off the rest */

drivers/video/fbdev/bw2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
182182

183183
static void bw2_init_fix(struct fb_info *info, int linebytes)
184184
{
185-
strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id));
185+
strscpy(info->fix.id, "bwtwo", sizeof(info->fix.id));
186186

187187
info->fix.type = FB_TYPE_PACKED_PIXELS;
188188
info->fix.visual = FB_VISUAL_MONO01;

drivers/video/fbdev/chipsfb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
430430
err_release_fb:
431431
framebuffer_release(p);
432432
err_disable:
433+
pci_disable_device(dp);
433434
err_out:
434435
return rc;
435436
}

drivers/video/fbdev/cirrusfb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ static int cirrusfb_set_fbinfo(struct fb_info *info)
19991999
}
20002000

20012001
/* Fill fix common fields */
2002-
strlcpy(info->fix.id, cirrusfb_board_info[cinfo->btype].name,
2002+
strscpy(info->fix.id, cirrusfb_board_info[cinfo->btype].name,
20032003
sizeof(info->fix.id));
20042004

20052005
/* monochrome: only 1 memory plane */

drivers/video/fbdev/clps711x-fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static int clps711x_fb_probe(struct platform_device *pdev)
326326
info->var.vmode = FB_VMODE_NONINTERLACED;
327327
info->fix.type = FB_TYPE_PACKED_PIXELS;
328328
info->fix.accel = FB_ACCEL_NONE;
329-
strlcpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id));
329+
strscpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id));
330330
fb_videomode_to_var(&info->var, &cfb->mode);
331331

332332
ret = fb_alloc_cmap(&info->cmap, BIT(CLPS711X_FB_BPP_MAX), 0);

drivers/video/fbdev/core/fbcon.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static int __init fb_console_setup(char *this_opt)
412412

413413
while ((options = strsep(&this_opt, ",")) != NULL) {
414414
if (!strncmp(options, "font:", 5)) {
415-
strlcpy(fontname, options + 5, sizeof(fontname));
415+
strscpy(fontname, options + 5, sizeof(fontname));
416416
continue;
417417
}
418418

@@ -2401,15 +2401,21 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
24012401
struct fb_info *info = fbcon_info_from_console(vc->vc_num);
24022402
struct fbcon_ops *ops = info->fbcon_par;
24032403
struct fbcon_display *p = &fb_display[vc->vc_num];
2404-
int resize;
2404+
int resize, ret, old_userfont, old_width, old_height, old_charcount;
24052405
char *old_data = NULL;
24062406

24072407
resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
24082408
if (p->userfont)
24092409
old_data = vc->vc_font.data;
24102410
vc->vc_font.data = (void *)(p->fontdata = data);
2411+
old_userfont = p->userfont;
24112412
if ((p->userfont = userfont))
24122413
REFCOUNT(data)++;
2414+
2415+
old_width = vc->vc_font.width;
2416+
old_height = vc->vc_font.height;
2417+
old_charcount = vc->vc_font.charcount;
2418+
24132419
vc->vc_font.width = w;
24142420
vc->vc_font.height = h;
24152421
vc->vc_font.charcount = charcount;
@@ -2425,7 +2431,9 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
24252431
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
24262432
cols /= w;
24272433
rows /= h;
2428-
vc_resize(vc, cols, rows);
2434+
ret = vc_resize(vc, cols, rows);
2435+
if (ret)
2436+
goto err_out;
24292437
} else if (con_is_visible(vc)
24302438
&& vc->vc_mode == KD_TEXT) {
24312439
fbcon_clear_margins(vc, 0);
@@ -2435,6 +2443,21 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
24352443
if (old_data && (--REFCOUNT(old_data) == 0))
24362444
kfree(old_data - FONT_EXTRA_WORDS * sizeof(int));
24372445
return 0;
2446+
2447+
err_out:
2448+
p->fontdata = old_data;
2449+
vc->vc_font.data = (void *)old_data;
2450+
2451+
if (userfont) {
2452+
p->userfont = old_userfont;
2453+
REFCOUNT(data)--;
2454+
}
2455+
2456+
vc->vc_font.width = old_width;
2457+
vc->vc_font.height = old_height;
2458+
vc->vc_font.charcount = old_charcount;
2459+
2460+
return ret;
24382461
}
24392462

24402463
/*

drivers/video/fbdev/core/fbsysfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ void framebuffer_release(struct fb_info *info)
8484
if (WARN_ON(refcount_read(&info->count)))
8585
return;
8686

87+
#if IS_ENABLED(CONFIG_FB_BACKLIGHT)
88+
mutex_destroy(&info->bl_curve_mutex);
89+
#endif
90+
8791
kfree(info->apertures);
8892
kfree(info);
8993
}

drivers/video/fbdev/cyber2000fb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ int cyber2000fb_attach(struct cyberpro_info *info, int idx)
11341134
info->fb_size = int_cfb_info->fb.fix.smem_len;
11351135
info->info = int_cfb_info;
11361136

1137-
strlcpy(info->dev_name, int_cfb_info->fb.fix.id,
1137+
strscpy(info->dev_name, int_cfb_info->fb.fix.id,
11381138
sizeof(info->dev_name));
11391139
}
11401140

@@ -1229,7 +1229,7 @@ static int cyber2000fb_ddc_getsda(void *data)
12291229

12301230
static int cyber2000fb_setup_ddc_bus(struct cfb_info *cfb)
12311231
{
1232-
strlcpy(cfb->ddc_adapter.name, cfb->fb.fix.id,
1232+
strscpy(cfb->ddc_adapter.name, cfb->fb.fix.id,
12331233
sizeof(cfb->ddc_adapter.name));
12341234
cfb->ddc_adapter.owner = THIS_MODULE;
12351235
cfb->ddc_adapter.class = I2C_CLASS_DDC;
@@ -1304,7 +1304,7 @@ static int cyber2000fb_i2c_getscl(void *data)
13041304

13051305
static int cyber2000fb_i2c_register(struct cfb_info *cfb)
13061306
{
1307-
strlcpy(cfb->i2c_adapter.name, cfb->fb.fix.id,
1307+
strscpy(cfb->i2c_adapter.name, cfb->fb.fix.id,
13081308
sizeof(cfb->i2c_adapter.name));
13091309
cfb->i2c_adapter.owner = THIS_MODULE;
13101310
cfb->i2c_adapter.algo_data = &cfb->i2c_algo;
@@ -1500,7 +1500,7 @@ static int cyber2000fb_setup(char *options)
15001500
if (strncmp(opt, "font:", 5) == 0) {
15011501
static char default_font_storage[40];
15021502

1503-
strlcpy(default_font_storage, opt + 5,
1503+
strscpy(default_font_storage, opt + 5,
15041504
sizeof(default_font_storage));
15051505
default_font = default_font_storage;
15061506
continue;

0 commit comments

Comments
 (0)