* [PATCH 0/4] drm/omap: minor fixes
@ 2018-05-02 9:11 Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 1/4] drm/omap: check return value from soc_device_match Tomi Valkeinen
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Tomi Valkeinen @ 2018-05-02 9:11 UTC (permalink / raw)
To: dri-devel, Laurent Pinchart; +Cc: Tomi Valkeinen
Hi,
This series has some minor fixes found by a static analysis tool, and one for
missing linefeeds. As far as I know, we have never hit any of those errors.
Tomi
Tomi Valkeinen (4):
drm/omap: check return value from soc_device_match
drm/omap: handle error if scale coefs are not found
drm/omap: add missing linefeeds to prints
drm/omap: handle alloc failures in omap_connector
drivers/gpu/drm/omapdrm/dss/dispc.c | 20 +++++++++++++-------
drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 7 ++++++-
drivers/gpu/drm/omapdrm/omap_connector.c | 10 ++++++++++
3 files changed, 29 insertions(+), 8 deletions(-)
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] drm/omap: check return value from soc_device_match
2018-05-02 9:11 [PATCH 0/4] drm/omap: minor fixes Tomi Valkeinen
@ 2018-05-02 9:11 ` Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 2/4] drm/omap: handle error if scale coefs are not found Tomi Valkeinen
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tomi Valkeinen @ 2018-05-02 9:11 UTC (permalink / raw)
To: dri-devel, Laurent Pinchart; +Cc: Tomi Valkeinen
soc_device_match() can return NULL, so add a check and fail if
soc_device_match() fails.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
index 35ed2add6189..813ba42f2753 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
@@ -922,8 +922,13 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
{
const struct hdmi4_features *features;
struct resource *res;
+ const struct soc_device_attribute *soc;
- features = soc_device_match(hdmi4_soc_devices)->data;
+ soc = soc_device_match(hdmi4_soc_devices);
+ if (!soc)
+ return -ENODEV;
+
+ features = soc->data;
core->cts_swmode = features->cts_swmode;
core->audio_use_mclk = features->audio_use_mclk;
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] drm/omap: handle error if scale coefs are not found
2018-05-02 9:11 [PATCH 0/4] drm/omap: minor fixes Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 1/4] drm/omap: check return value from soc_device_match Tomi Valkeinen
@ 2018-05-02 9:11 ` Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 3/4] drm/omap: add missing linefeeds to prints Tomi Valkeinen
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tomi Valkeinen @ 2018-05-02 9:11 UTC (permalink / raw)
To: dri-devel, Laurent Pinchart; +Cc: Tomi Valkeinen
If get_scale_coef functions fail, they return NULL, but we never check
the return value and could do a NULL deref. This should not happen as we
ought to validate the amount of scaling already earlier, but to be safe,
add the necessary check.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/gpu/drm/omapdrm/dss/dispc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 5e2e65e88847..b8fdb63e5bb3 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -828,6 +828,12 @@ static void dispc_ovl_set_scale_coef(struct dispc_device *dispc,
h_coef = dispc_ovl_get_scale_coef(fir_hinc, true);
v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps);
+ if (!h_coef || !v_coef) {
+ dev_err(&dispc->pdev->dev, "%s: failed to find scale coefs\n",
+ __func__);
+ return;
+ }
+
for (i = 0; i < 8; i++) {
u32 h, hv;
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] drm/omap: add missing linefeeds to prints
2018-05-02 9:11 [PATCH 0/4] drm/omap: minor fixes Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 1/4] drm/omap: check return value from soc_device_match Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 2/4] drm/omap: handle error if scale coefs are not found Tomi Valkeinen
@ 2018-05-02 9:11 ` Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 4/4] drm/omap: handle alloc failures in omap_connector Tomi Valkeinen
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tomi Valkeinen @ 2018-05-02 9:11 UTC (permalink / raw)
To: dri-devel, Laurent Pinchart; +Cc: Tomi Valkeinen
A bunch of debug and error prints are missing linefeeds. Add those.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/gpu/drm/omapdrm/dss/dispc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index b8fdb63e5bb3..7f3ac6b13b56 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -2348,7 +2348,7 @@ static int dispc_ovl_calc_scaling_24xx(struct dispc_device *dispc,
}
if (in_width > maxsinglelinewidth) {
- DSSERR("Cannot scale max input width exceeded");
+ DSSERR("Cannot scale max input width exceeded\n");
return -EINVAL;
}
return 0;
@@ -2430,13 +2430,13 @@ static int dispc_ovl_calc_scaling_34xx(struct dispc_device *dispc,
}
if (in_width > (maxsinglelinewidth * 2)) {
- DSSERR("Cannot setup scaling");
- DSSERR("width exceeds maximum width possible");
+ DSSERR("Cannot setup scaling\n");
+ DSSERR("width exceeds maximum width possible\n");
return -EINVAL;
}
if (in_width > maxsinglelinewidth && *five_taps) {
- DSSERR("cannot setup scaling with five taps");
+ DSSERR("cannot setup scaling with five taps\n");
return -EINVAL;
}
return 0;
@@ -2478,7 +2478,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
in_width > maxsinglelinewidth && ++*decim_x);
if (in_width > maxsinglelinewidth) {
- DSSERR("Cannot scale width exceeds max line width");
+ DSSERR("Cannot scale width exceeds max line width\n");
return -EINVAL;
}
@@ -2496,7 +2496,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
* bandwidth. Despite what theory says this appears to
* be true also for 16-bit color formats.
*/
- DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)", *decim_x);
+ DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)\n", *decim_x);
return -EINVAL;
}
@@ -4639,7 +4639,7 @@ static int dispc_errata_i734_wa_init(struct dispc_device *dispc)
i734_buf.size, &i734_buf.paddr,
GFP_KERNEL);
if (!i734_buf.vaddr) {
- dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed",
+ dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed\n",
__func__);
return -ENOMEM;
}
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] drm/omap: handle alloc failures in omap_connector
2018-05-02 9:11 [PATCH 0/4] drm/omap: minor fixes Tomi Valkeinen
` (2 preceding siblings ...)
2018-05-02 9:11 ` [PATCH 3/4] drm/omap: add missing linefeeds to prints Tomi Valkeinen
@ 2018-05-02 9:11 ` Tomi Valkeinen
2018-05-03 13:32 ` [PATCH 0/4] drm/omap: minor fixes Peter Ujfalusi
2018-05-03 14:01 ` Benoit Parrot
5 siblings, 0 replies; 7+ messages in thread
From: Tomi Valkeinen @ 2018-05-02 9:11 UTC (permalink / raw)
To: dri-devel, Laurent Pinchart; +Cc: Tomi Valkeinen
Handle memory allocation failures in omap_connector to avoid NULL
derefs.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/gpu/drm/omapdrm/omap_connector.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index a0d7b1d905e8..5cde26ac937b 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -121,6 +121,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
if (dssdrv->read_edid) {
void *edid = kzalloc(MAX_EDID, GFP_KERNEL);
+ if (!edid)
+ return 0;
+
if ((dssdrv->read_edid(dssdev, edid, MAX_EDID) > 0) &&
drm_edid_is_valid(edid)) {
drm_mode_connector_update_edid_property(
@@ -139,6 +142,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
struct drm_display_mode *mode = drm_mode_create(dev);
struct videomode vm = {0};
+ if (!mode)
+ return 0;
+
dssdrv->get_timings(dssdev, &vm);
drm_display_mode_from_videomode(&vm, mode);
@@ -200,6 +206,10 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
if (!r) {
/* check if vrefresh is still valid */
new_mode = drm_mode_duplicate(dev, mode);
+
+ if (!new_mode)
+ return MODE_BAD;
+
new_mode->clock = vm.pixelclock / 1000;
new_mode->vrefresh = 0;
if (mode->vrefresh == drm_mode_vrefresh(new_mode))
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] drm/omap: minor fixes
2018-05-02 9:11 [PATCH 0/4] drm/omap: minor fixes Tomi Valkeinen
` (3 preceding siblings ...)
2018-05-02 9:11 ` [PATCH 4/4] drm/omap: handle alloc failures in omap_connector Tomi Valkeinen
@ 2018-05-03 13:32 ` Peter Ujfalusi
2018-05-03 14:01 ` Benoit Parrot
5 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2018-05-03 13:32 UTC (permalink / raw)
To: Tomi Valkeinen, dri-devel, Laurent Pinchart
On 2018-05-02 12:11, Tomi Valkeinen wrote:
> Hi,
>
> This series has some minor fixes found by a static analysis tool, and one for
> missing linefeeds. As far as I know, we have never hit any of those errors.
To all:
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>
> Tomi
>
> Tomi Valkeinen (4):
> drm/omap: check return value from soc_device_match
> drm/omap: handle error if scale coefs are not found
> drm/omap: add missing linefeeds to prints
> drm/omap: handle alloc failures in omap_connector
>
> drivers/gpu/drm/omapdrm/dss/dispc.c | 20 +++++++++++++-------
> drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 7 ++++++-
> drivers/gpu/drm/omapdrm/omap_connector.c | 10 ++++++++++
> 3 files changed, 29 insertions(+), 8 deletions(-)
>
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] drm/omap: minor fixes
2018-05-02 9:11 [PATCH 0/4] drm/omap: minor fixes Tomi Valkeinen
` (4 preceding siblings ...)
2018-05-03 13:32 ` [PATCH 0/4] drm/omap: minor fixes Peter Ujfalusi
@ 2018-05-03 14:01 ` Benoit Parrot
5 siblings, 0 replies; 7+ messages in thread
From: Benoit Parrot @ 2018-05-03 14:01 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: Laurent Pinchart, dri-devel
For the series,
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Tomi Valkeinen <tomi.valkeinen@ti.com> wrote on Wed [2018-May-02 12:11:55 +0300]:
> Hi,
>
> This series has some minor fixes found by a static analysis tool, and one for
> missing linefeeds. As far as I know, we have never hit any of those errors.
>
> Tomi
>
> Tomi Valkeinen (4):
> drm/omap: check return value from soc_device_match
> drm/omap: handle error if scale coefs are not found
> drm/omap: add missing linefeeds to prints
> drm/omap: handle alloc failures in omap_connector
>
> drivers/gpu/drm/omapdrm/dss/dispc.c | 20 +++++++++++++-------
> drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 7 ++++++-
> drivers/gpu/drm/omapdrm/omap_connector.c | 10 ++++++++++
> 3 files changed, 29 insertions(+), 8 deletions(-)
>
> --
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-03 14:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-02 9:11 [PATCH 0/4] drm/omap: minor fixes Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 1/4] drm/omap: check return value from soc_device_match Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 2/4] drm/omap: handle error if scale coefs are not found Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 3/4] drm/omap: add missing linefeeds to prints Tomi Valkeinen
2018-05-02 9:11 ` [PATCH 4/4] drm/omap: handle alloc failures in omap_connector Tomi Valkeinen
2018-05-03 13:32 ` [PATCH 0/4] drm/omap: minor fixes Peter Ujfalusi
2018-05-03 14:01 ` Benoit Parrot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.