audio_config function for both HDMI4 and HDMI5 return uninitialized value as the error code if the display is not currently enabled. For some reason this has not caused any issues.
Signed-off-by: Tomi Valkeinen tomi.valkeinen@ti.com --- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 2 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 97c88861d67a..5879f45f6fc9 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -679,7 +679,7 @@ static int hdmi_audio_config(struct device *dev, struct omap_dss_audio *dss_audio) { struct omap_hdmi *hd = dev_get_drvdata(dev); - int ret; + int ret = 0;
mutex_lock(&hd->lock);
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index d28da9ac3e90..ae1a001d1b83 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -671,7 +671,7 @@ static int hdmi_audio_config(struct device *dev, struct omap_dss_audio *dss_audio) { struct omap_hdmi *hd = dev_get_drvdata(dev); - int ret; + int ret = 0;
mutex_lock(&hd->lock);
tiler_reserve_2d allocates memory but does not check if it got the memory. Add the check and return ENOMEM on failure.
Signed-off-by: Tomi Valkeinen tomi.valkeinen@ti.com --- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index c40f90d2db82..28d93ece191e 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -532,6 +532,9 @@ struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w, unsigned long flags; u32 slot_bytes;
+ if (!block) + return ERR_PTR(-ENOMEM); + BUG_ON(!validfmt(fmt));
/* convert width/height to slots */
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
tiler_reserve_2d allocates memory but does not check if it got the memory. Add the check and return ENOMEM on failure.
Signed-off-by: Tomi Valkeinen tomi.valkeinen@ti.com
It's funny when the function call (kzalloc here) is just outside the context ;-)
Reviewed-by: Emil Velikov emil.velikov@collabora.com
-Emil
Hi Tomi,
Thank you for the patch.
On Thursday, 29 March 2018 13:40:37 EEST Tomi Valkeinen wrote:
tiler_reserve_2d allocates memory but does not check if it got the memory. Add the check and return ENOMEM on failure.
Signed-off-by: Tomi Valkeinen tomi.valkeinen@ti.com
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index c40f90d2db82..28d93ece191e 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -532,6 +532,9 @@ struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w, unsigned long flags; u32 slot_bytes;
- if (!block)
return ERR_PTR(-ENOMEM);
I'd write this as
struct tiler_block *block; ...
block = kzalloc(sizeof(*block), GFP_KERNEL); if (!block) return ERR_PTR(-ENOMEM);
to make it clearer. I'll leave it up to you though, so in any case
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
BUG_ON(!validfmt(fmt));
/* convert width/height to slots */
omap_framebuffer_get_next_connector() is not used, remove it.
Signed-off-by: Tomi Valkeinen tomi.valkeinen@ti.com --- drivers/gpu/drm/omapdrm/omap_fb.c | 27 --------------------------- drivers/gpu/drm/omapdrm/omap_fb.h | 2 -- 2 files changed, 29 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index 5fd22ca73913..b54bcaad5cd1 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c @@ -309,33 +309,6 @@ void omap_framebuffer_unpin(struct drm_framebuffer *fb) mutex_unlock(&omap_fb->lock); }
-/* iterate thru all the connectors, returning ones that are attached - * to the same fb.. - */ -struct drm_connector *omap_framebuffer_get_next_connector( - struct drm_framebuffer *fb, struct drm_connector *from) -{ - struct drm_device *dev = fb->dev; - struct list_head *connector_list = &dev->mode_config.connector_list; - struct drm_connector *connector = from; - - if (!from) - return list_first_entry_or_null(connector_list, typeof(*from), - head); - - list_for_each_entry_from(connector, connector_list, head) { - if (connector != from) { - struct drm_encoder *encoder = connector->encoder; - struct drm_crtc *crtc = encoder ? encoder->crtc : NULL; - if (crtc && crtc->primary->fb == fb) - return connector; - - } - } - - return NULL; -} - #ifdef CONFIG_DEBUG_FS void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m) { diff --git a/drivers/gpu/drm/omapdrm/omap_fb.h b/drivers/gpu/drm/omapdrm/omap_fb.h index 94ad5f9e4404..c20cb4bc714d 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.h +++ b/drivers/gpu/drm/omapdrm/omap_fb.h @@ -38,8 +38,6 @@ int omap_framebuffer_pin(struct drm_framebuffer *fb); void omap_framebuffer_unpin(struct drm_framebuffer *fb); void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, struct drm_plane_state *state, struct omap_overlay_info *info); -struct drm_connector *omap_framebuffer_get_next_connector( - struct drm_framebuffer *fb, struct drm_connector *from); bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb); void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m);
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
omap_framebuffer_get_next_connector() is not used, remove it.
Seems to have been unused for a few years now. Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
Reviewed-by: Emil Velikov emil.velikov@collabora.com
-Emil
Hi,
On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
omap_framebuffer_get_next_connector() is not used, remove it.
Seems to have been unused for a few years now. Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
Reviewed-by: Emil Velikov emil.velikov@collabora.com
I have a pending patch using that function to basically restore the functionality from the referenced commit:
https://patchwork.kernel.org/patch/10207759/
-- Sebastian
On 29/03/18 15:31, Sebastian Reichel wrote:
Hi,
On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
omap_framebuffer_get_next_connector() is not used, remove it.
Seems to have been unused for a few years now. Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
Reviewed-by: Emil Velikov emil.velikov@collabora.com
I have a pending patch using that function to basically restore the functionality from the referenced commit:
Oh, ok. I'll drop this patch. These was a Klocwork warning for this function, so the easiest fix was to remove it.
drivers/gpu/drm/omapdrm/omap_fb.c:326 INFINITE_LOOP.LOCAL (2:Error) Analyze Infinite loop * omap_fb.c:326: Entering loop with precondition (from!=0) && (connector!=0) && from == connector * omap_fb.c:326: condition 0 is always false * omap_fb.c:326: condition 0 is always false * omap_fb.c:327: condition connector!=from is always false
Tomi
Hi,
On Thu, Mar 29, 2018 at 03:49:08PM +0300, Tomi Valkeinen wrote:
On 29/03/18 15:31, Sebastian Reichel wrote:
Hi,
On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
omap_framebuffer_get_next_connector() is not used, remove it.
Seems to have been unused for a few years now. Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
Reviewed-by: Emil Velikov emil.velikov@collabora.com
I have a pending patch using that function to basically restore the functionality from the referenced commit:
Oh, ok. I'll drop this patch.
Thanks.
These was a Klocwork warning for this function, so the easiest fix was to remove it.
drivers/gpu/drm/omapdrm/omap_fb.c:326 INFINITE_LOOP.LOCAL (2:Error) Analyze Infinite loop
- omap_fb.c:326: Entering loop with precondition (from!=0) &&
(connector!=0) && from == connector
This makes sense to me, since the code initializes connector to from and returns early if from is NULL.
- omap_fb.c:326: condition 0 is always false
- omap_fb.c:326: condition 0 is always false
- omap_fb.c:327: condition connector!=from is always false
Looks like list_for_each_entry_from() is not properly understood by the static checker?
-- Sebastian
On 29/03/18 17:44, Sebastian Reichel wrote:
- omap_fb.c:326: condition 0 is always false
- omap_fb.c:326: condition 0 is always false
- omap_fb.c:327: condition connector!=from is always false
Looks like list_for_each_entry_from() is not properly understood by the static checker?
I've seen a bunch of false positives from the checker, but this one is the first where it indeed looks like the checker is confused. Or alternatively it's too clever for us =).
Tomi
On 29 March 2018 at 13:31, Sebastian Reichel sebastian.reichel@collabora.co.uk wrote:
Hi,
On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
omap_framebuffer_get_next_connector() is not used, remove it.
Seems to have been unused for a few years now. Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
Reviewed-by: Emil Velikov emil.velikov@collabora.com
I have a pending patch using that function to basically restore the functionality from the referenced commit:
Hmm I can see very few users of dirtyfb - modesetting, opentegra, vmgfx, intel (sna only) + the odd IGT test.
Wondering if that's because it doesn't provide that much of a benefit... Although it might be because DRM drivers don't fully implement the functionality ;-)
Just thinking out loud ^^.
-Emil
Hi,
On Thu, Mar 29, 2018 at 02:24:40PM +0100, Emil Velikov wrote:
On 29 March 2018 at 13:31, Sebastian Reichel sebastian.reichel@collabora.co.uk wrote:
Hi,
On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
omap_framebuffer_get_next_connector() is not used, remove it.
Seems to have been unused for a few years now. Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
Reviewed-by: Emil Velikov emil.velikov@collabora.com
I have a pending patch using that function to basically restore the functionality from the referenced commit:
Hmm I can see very few users of dirtyfb - modesetting, opentegra, vmgfx, intel (sna only) + the odd IGT test.
Wondering if that's because it doesn't provide that much of a benefit... Although it might be because DRM drivers don't fully implement the functionality ;-)
Just thinking out loud ^^.
Most DRM drivers don't implement DSI's command mode. That's not surprising, if you consider that the typical development boards don't have panels supporting DSI command mode. A quick grep from me suggested, that rockchip supports DSI command mode and they also use dirtyfb.
Also the benefit of panel self refresh seems to be big enough, that intel tries to enable it by default since quite some time :)
Note, that in mobile phones DSI command mode panels are not as rare as on the development boards. Nokia N950, N9 and Droid 4 each have one of those displays.
-- Sebastian
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
audio_config function for both HDMI4 and HDMI5 return uninitialized value as the error code if the display is not currently enabled. For some reason this has not caused any issues.
Doubt many people try hdmi audio with disabled display ;-)
Reviewed-by: Emil Velikov emil.velikov@collabora.com
-Emil
On 29/03/18 13:58, Emil Velikov wrote:
On 29 March 2018 at 11:40, Tomi Valkeinen tomi.valkeinen@ti.com wrote:
audio_config function for both HDMI4 and HDMI5 return uninitialized value as the error code if the display is not currently enabled. For some reason this has not caused any issues.
Doubt many people try hdmi audio with disabled display ;-)
I think it can happen if the display is connected but blanked.
Reviewed-by: Emil Velikov emil.velikov@collabora.com
Thanks for the review!
Tomi
Hi Tomi,
Thank you for the patch.
On Thursday, 29 March 2018 13:40:36 EEST Tomi Valkeinen wrote:
audio_config function for both HDMI4 and HDMI5 return uninitialized value as the error code if the display is not currently enabled. For some reason this has not caused any issues.
Signed-off-by: Tomi Valkeinen tomi.valkeinen@ti.com
I wonder why the compiler hasn't caught this before.
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/omapdrm/dss/hdmi4.c | 2 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 97c88861d67a..5879f45f6fc9 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -679,7 +679,7 @@ static int hdmi_audio_config(struct device *dev, struct omap_dss_audio *dss_audio) { struct omap_hdmi *hd = dev_get_drvdata(dev);
- int ret;
int ret = 0;
mutex_lock(&hd->lock);
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index d28da9ac3e90..ae1a001d1b83 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -671,7 +671,7 @@ static int hdmi_audio_config(struct device *dev, struct omap_dss_audio *dss_audio) { struct omap_hdmi *hd = dev_get_drvdata(dev);
- int ret;
int ret = 0;
mutex_lock(&hd->lock);
dri-devel@lists.freedesktop.org