Skip to content

Commit 44ef02c

Browse files
committed
Merge tag 'drm-misc-fixes-2018-05-09' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
atomic: Clear state pointers on clear (Ville) vc4: Fix oops in dpi disable (Eric) omap: Various error-checking + uninitialized var fixes (Tomi) Cc: Ville Syrjälä <[email protected]> Cc: Eric Anholt <[email protected]> Cc: Tomi Valkeinen <[email protected]> * tag 'drm-misc-fixes-2018-05-09' of git://anongit.freedesktop.org/drm/drm-misc: drm/vc4: Fix scaling of uni-planar formats drm/bridge/sii8620: add Kconfig dependency on extcon drm/omap: handle alloc failures in omap_connector drm/omap: add missing linefeeds to prints drm/omap: handle error if scale coefs are not found drm/omap: check return value from soc_device_match drm/omap: fix possible NULL ref issue in tiler_reserve_2d drm/omap: fix uninitialized ret variable drm/omap: silence unititialized variable warning drm/vc4: Fix oops dereferencing DPI's connector since panel_bridge. drm/atomic: Clean private obj old_state/new_state in drm_atomic_state_default_clear() drm/atomic: Clean old_state/new_state in drm_atomic_state_default_clear()
2 parents 03a0a3e + 9a0e980 commit 44ef02c

File tree

11 files changed

+69
-16
lines changed

11 files changed

+69
-16
lines changed

drivers/gpu/drm/bridge/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ config DRM_SIL_SII8620
7474
tristate "Silicon Image SII8620 HDMI/MHL bridge"
7575
depends on OF && RC_CORE
7676
select DRM_KMS_HELPER
77+
imply EXTCON
7778
help
7879
Silicon Image SII8620 HDMI/MHL bridge chip driver.
7980

drivers/gpu/drm/drm_atomic.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
155155
state->connectors[i].state);
156156
state->connectors[i].ptr = NULL;
157157
state->connectors[i].state = NULL;
158+
state->connectors[i].old_state = NULL;
159+
state->connectors[i].new_state = NULL;
158160
drm_connector_put(connector);
159161
}
160162

@@ -169,6 +171,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
169171

170172
state->crtcs[i].ptr = NULL;
171173
state->crtcs[i].state = NULL;
174+
state->crtcs[i].old_state = NULL;
175+
state->crtcs[i].new_state = NULL;
172176
}
173177

174178
for (i = 0; i < config->num_total_plane; i++) {
@@ -181,6 +185,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
181185
state->planes[i].state);
182186
state->planes[i].ptr = NULL;
183187
state->planes[i].state = NULL;
188+
state->planes[i].old_state = NULL;
189+
state->planes[i].new_state = NULL;
184190
}
185191

186192
for (i = 0; i < state->num_private_objs; i++) {
@@ -190,6 +196,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
190196
state->private_objs[i].state);
191197
state->private_objs[i].ptr = NULL;
192198
state->private_objs[i].state = NULL;
199+
state->private_objs[i].old_state = NULL;
200+
state->private_objs[i].new_state = NULL;
193201
}
194202
state->num_private_objs = 0;
195203

drivers/gpu/drm/omapdrm/dss/dispc.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,12 @@ static void dispc_ovl_set_scale_coef(struct dispc_device *dispc,
828828
h_coef = dispc_ovl_get_scale_coef(fir_hinc, true);
829829
v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps);
830830

831+
if (!h_coef || !v_coef) {
832+
dev_err(&dispc->pdev->dev, "%s: failed to find scale coefs\n",
833+
__func__);
834+
return;
835+
}
836+
831837
for (i = 0; i < 8; i++) {
832838
u32 h, hv;
833839

@@ -2342,7 +2348,7 @@ static int dispc_ovl_calc_scaling_24xx(struct dispc_device *dispc,
23422348
}
23432349

23442350
if (in_width > maxsinglelinewidth) {
2345-
DSSERR("Cannot scale max input width exceeded");
2351+
DSSERR("Cannot scale max input width exceeded\n");
23462352
return -EINVAL;
23472353
}
23482354
return 0;
@@ -2424,13 +2430,13 @@ static int dispc_ovl_calc_scaling_34xx(struct dispc_device *dispc,
24242430
}
24252431

24262432
if (in_width > (maxsinglelinewidth * 2)) {
2427-
DSSERR("Cannot setup scaling");
2428-
DSSERR("width exceeds maximum width possible");
2433+
DSSERR("Cannot setup scaling\n");
2434+
DSSERR("width exceeds maximum width possible\n");
24292435
return -EINVAL;
24302436
}
24312437

24322438
if (in_width > maxsinglelinewidth && *five_taps) {
2433-
DSSERR("cannot setup scaling with five taps");
2439+
DSSERR("cannot setup scaling with five taps\n");
24342440
return -EINVAL;
24352441
}
24362442
return 0;
@@ -2472,7 +2478,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
24722478
in_width > maxsinglelinewidth && ++*decim_x);
24732479

24742480
if (in_width > maxsinglelinewidth) {
2475-
DSSERR("Cannot scale width exceeds max line width");
2481+
DSSERR("Cannot scale width exceeds max line width\n");
24762482
return -EINVAL;
24772483
}
24782484

@@ -2490,7 +2496,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
24902496
* bandwidth. Despite what theory says this appears to
24912497
* be true also for 16-bit color formats.
24922498
*/
2493-
DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)", *decim_x);
2499+
DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)\n", *decim_x);
24942500

24952501
return -EINVAL;
24962502
}
@@ -4633,7 +4639,7 @@ static int dispc_errata_i734_wa_init(struct dispc_device *dispc)
46334639
i734_buf.size, &i734_buf.paddr,
46344640
GFP_KERNEL);
46354641
if (!i734_buf.vaddr) {
4636-
dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed",
4642+
dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed\n",
46374643
__func__);
46384644
return -ENOMEM;
46394645
}

drivers/gpu/drm/omapdrm/dss/hdmi4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ static int hdmi_audio_config(struct device *dev,
679679
struct omap_dss_audio *dss_audio)
680680
{
681681
struct omap_hdmi *hd = dev_get_drvdata(dev);
682-
int ret;
682+
int ret = 0;
683683

684684
mutex_lock(&hd->lock);
685685

drivers/gpu/drm/omapdrm/dss/hdmi4_core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,13 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
922922
{
923923
const struct hdmi4_features *features;
924924
struct resource *res;
925+
const struct soc_device_attribute *soc;
925926

926-
features = soc_device_match(hdmi4_soc_devices)->data;
927+
soc = soc_device_match(hdmi4_soc_devices);
928+
if (!soc)
929+
return -ENODEV;
930+
931+
features = soc->data;
927932
core->cts_swmode = features->cts_swmode;
928933
core->audio_use_mclk = features->audio_use_mclk;
929934

drivers/gpu/drm/omapdrm/dss/hdmi5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ static int hdmi_audio_config(struct device *dev,
671671
struct omap_dss_audio *dss_audio)
672672
{
673673
struct omap_hdmi *hd = dev_get_drvdata(dev);
674-
int ret;
674+
int ret = 0;
675675

676676
mutex_lock(&hd->lock);
677677

drivers/gpu/drm/omapdrm/omap_connector.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
121121
if (dssdrv->read_edid) {
122122
void *edid = kzalloc(MAX_EDID, GFP_KERNEL);
123123

124+
if (!edid)
125+
return 0;
126+
124127
if ((dssdrv->read_edid(dssdev, edid, MAX_EDID) > 0) &&
125128
drm_edid_is_valid(edid)) {
126129
drm_mode_connector_update_edid_property(
@@ -139,6 +142,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
139142
struct drm_display_mode *mode = drm_mode_create(dev);
140143
struct videomode vm = {0};
141144

145+
if (!mode)
146+
return 0;
147+
142148
dssdrv->get_timings(dssdev, &vm);
143149

144150
drm_display_mode_from_videomode(&vm, mode);
@@ -200,6 +206,10 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
200206
if (!r) {
201207
/* check if vrefresh is still valid */
202208
new_mode = drm_mode_duplicate(dev, mode);
209+
210+
if (!new_mode)
211+
return MODE_BAD;
212+
203213
new_mode->clock = vm.pixelclock / 1000;
204214
new_mode->vrefresh = 0;
205215
if (mode->vrefresh == drm_mode_vrefresh(new_mode))

drivers/gpu/drm/omapdrm/omap_dmm_tiler.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,16 @@ int tiler_unpin(struct tiler_block *block)
401401
struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w,
402402
u16 h, u16 align)
403403
{
404-
struct tiler_block *block = kzalloc(sizeof(*block), GFP_KERNEL);
404+
struct tiler_block *block;
405405
u32 min_align = 128;
406406
int ret;
407407
unsigned long flags;
408408
u32 slot_bytes;
409409

410+
block = kzalloc(sizeof(*block), GFP_KERNEL);
411+
if (!block)
412+
return ERR_PTR(-ENOMEM);
413+
410414
BUG_ON(!validfmt(fmt));
411415

412416
/* convert width/height to slots */

drivers/gpu/drm/omapdrm/tcm-sita.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int l2r_t2b(u16 w, u16 h, u16 a, s16 offset,
9090
{
9191
int i;
9292
unsigned long index;
93-
bool area_free;
93+
bool area_free = false;
9494
unsigned long slots_per_band = PAGE_SIZE / slot_bytes;
9595
unsigned long bit_offset = (offset > 0) ? offset / slot_bytes : 0;
9696
unsigned long curr_bit = bit_offset;

drivers/gpu/drm/vc4/vc4_dpi.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ struct vc4_dpi {
9696
struct platform_device *pdev;
9797

9898
struct drm_encoder *encoder;
99-
struct drm_connector *connector;
10099

101100
void __iomem *regs;
102101

@@ -164,14 +163,31 @@ static void vc4_dpi_encoder_disable(struct drm_encoder *encoder)
164163

165164
static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
166165
{
166+
struct drm_device *dev = encoder->dev;
167167
struct drm_display_mode *mode = &encoder->crtc->mode;
168168
struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder);
169169
struct vc4_dpi *dpi = vc4_encoder->dpi;
170+
struct drm_connector_list_iter conn_iter;
171+
struct drm_connector *connector = NULL, *connector_scan;
170172
u32 dpi_c = DPI_ENABLE | DPI_OUTPUT_ENABLE_MODE;
171173
int ret;
172174

173-
if (dpi->connector->display_info.num_bus_formats) {
174-
u32 bus_format = dpi->connector->display_info.bus_formats[0];
175+
/* Look up the connector attached to DPI so we can get the
176+
* bus_format. Ideally the bridge would tell us the
177+
* bus_format we want, but it doesn't yet, so assume that it's
178+
* uniform throughout the bridge chain.
179+
*/
180+
drm_connector_list_iter_begin(dev, &conn_iter);
181+
drm_for_each_connector_iter(connector_scan, &conn_iter) {
182+
if (connector_scan->encoder == encoder) {
183+
connector = connector_scan;
184+
break;
185+
}
186+
}
187+
drm_connector_list_iter_end(&conn_iter);
188+
189+
if (connector && connector->display_info.num_bus_formats) {
190+
u32 bus_format = connector->display_info.bus_formats[0];
175191

176192
switch (bus_format) {
177193
case MEDIA_BUS_FMT_RGB888_1X24:
@@ -199,6 +215,9 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
199215
DRM_ERROR("Unknown media bus format %d\n", bus_format);
200216
break;
201217
}
218+
} else {
219+
/* Default to 24bit if no connector found. */
220+
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);
202221
}
203222

204223
if (mode->flags & DRM_MODE_FLAG_NHSYNC)

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
503503
* the scl fields here.
504504
*/
505505
if (num_planes == 1) {
506-
scl0 = vc4_get_scl_field(state, 1);
506+
scl0 = vc4_get_scl_field(state, 0);
507507
scl1 = scl0;
508508
} else {
509509
scl0 = vc4_get_scl_field(state, 1);

0 commit comments

Comments
 (0)