Merge tag 'video-20220625' of https://source.denx.de/u-boot/custodians/u-boot-video
- fix building sandbox with NO_SDL=1
- fix stb TrueType to check return value of STBTT_malloc()
- remove not required DM_REGULATOR test in stm32 dsi driver
diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h
index e271a84..56dcb84 100644
--- a/arch/sandbox/include/asm/sdl.h
+++ b/arch/sandbox/include/asm/sdl.h
@@ -94,6 +94,11 @@
return -ENODEV;
}
+static inline int sandbox_sdl_remove_display(void)
+{
+ return -ENODEV;
+}
+
static inline int sandbox_sdl_sync(void *lcd_base)
{
return -ENODEV;
diff --git a/drivers/video/stb_truetype.h b/drivers/video/stb_truetype.h
index 26f4ac2..438bfce 100644
--- a/drivers/video/stb_truetype.h
+++ b/drivers/video/stb_truetype.h
@@ -1768,10 +1768,13 @@
int s; // vertical subsample index
unsigned char scanline_data[512], *scanline;
- if (result->w > 512)
+ if (result->w > 512) {
scanline = (unsigned char *) STBTT_malloc(result->w, userdata);
- else
+ if (!scanline)
+ return;
+ } else {
scanline = scanline_data;
+ }
y = off_y * vsubsample;
e[n].y0 = (off_y + result->h) * (float) vsubsample + 1;
@@ -1821,6 +1824,8 @@
while (e->y0 <= scan_y) {
if (e->y1 > scan_y) {
stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y, userdata);
+ if (!z)
+ return;
// find insertion point
if (active == NULL)
active = z;
@@ -2068,10 +2073,13 @@
int y,j=0, i;
float scanline_data[129], *scanline, *scanline2;
- if (result->w > 64)
+ if (result->w > 64) {
scanline = (float *) STBTT_malloc((result->w*2+1) * sizeof(float), userdata);
- else
+ if (!scanline)
+ return;
+ } else {
scanline = scanline_data;
+ }
scanline2 = scanline + result->w;
@@ -2105,6 +2113,8 @@
while (e->y0 <= scan_y_bottom) {
if (e->y0 != e->y1) {
stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata);
+ if (!z)
+ return;
STBTT_assert(z->ey >= scan_y_top);
// insert at front
z->next = active;
diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c
index 134abd9..5871ac7 100644
--- a/drivers/video/stm32/stm32_dsi.c
+++ b/drivers/video/stm32/stm32_dsi.c
@@ -433,19 +433,17 @@
return -EINVAL;
}
- if (IS_ENABLED(CONFIG_DM_REGULATOR)) {
- ret = device_get_supply_regulator(dev, "phy-dsi-supply",
- &priv->vdd_reg);
- if (ret && ret != -ENOENT) {
- dev_err(dev, "Warning: cannot get phy dsi supply\n");
- return -ENODEV;
- }
+ ret = device_get_supply_regulator(dev, "phy-dsi-supply",
+ &priv->vdd_reg);
+ if (ret && ret != -ENOENT) {
+ dev_err(dev, "Warning: cannot get phy dsi supply\n");
+ return -ENODEV;
+ }
- if (ret != -ENOENT) {
- ret = regulator_set_enable(priv->vdd_reg, true);
- if (ret)
- return ret;
- }
+ if (ret != -ENOENT) {
+ ret = regulator_set_enable(priv->vdd_reg, true);
+ if (ret)
+ return ret;
}
ret = clk_get_by_name(device->dev, "pclk", &clk);
@@ -493,8 +491,7 @@
err_clk:
clk_disable(&clk);
err_reg:
- if (IS_ENABLED(CONFIG_DM_REGULATOR))
- regulator_set_enable(priv->vdd_reg, false);
+ regulator_set_enable(priv->vdd_reg, false);
return ret;
}