[Intel-gfx] [PATCH v3] drm: move allocation out of drm_get_format_name()
Daniel Vetter
daniel at ffwll.ch
Wed Nov 9 01:13:25 UTC 2016
On Wed, Nov 09, 2016 at 02:09:16AM +0100, Daniel Vetter wrote:
> On Wed, Nov 09, 2016 at 12:17:52AM +0000, Eric Engestrom wrote:
> > The function's behaviour was changed in 90844f00049e, without changing
> > its signature, causing people to keep using it the old way without
> > realising they were now leaking memory.
> > Rob Clark also noticed it was also allocating GFP_KERNEL memory in
> > atomic contexts, breaking them.
> >
> > Instead of having to allocate GFP_ATOMIC memory and fixing the callers
> > to make them cleanup the memory afterwards, let's change the function's
> > signature by having the caller take care of the memory and passing it to
> > the function.
> > The new parameter is a single-field struct in order to enforce the size
> > of its buffer and help callers to correctly manage their memory.
> >
> > Fixes: 90844f00049e ("drm: make drm_get_format_name thread-safe")
> > Cc: Rob Clark <robdclark at gmail.com>
> > Cc: Christian König <christian.koenig at amd.com>
> > Acked-by: Christian König <christian.koenig at amd.com>
> > Acked-by: Rob Clark <robdclark at gmail.com>
> > Acked-by: Sinclair Yeh <syeh at vmware.com> (vmwgfx)
> > Reviewed-by: Jani Nikula <jani.nikula at intel.com>
> > Suggested-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> > ---
> > v3 - fix "Fixes" tag, replace it with an actual commit message
> > - collect ack & r-b
> >
> > v2 - use single-field struct instead of typedef to let the compiler
> > enforce the type (Christian König)
>
> Applied to drm-misc, thanks.
Well, had to drop it again since it didn't compile:
CC [M] drivers/gpu/drm/drm_blend.o
drivers/gpu/drm/drm_atomic.c: In function ‘drm_atomic_plane_print_state’:
drivers/gpu/drm/drm_atomic.c:920:5: error: too few arguments to function ‘drm_get_format_name’
drm_get_format_name(fb->pixel_format));
^~~~~~~~~~~~~~~~~~~
In file included from ./include/drm/drmP.h:71:0,
from drivers/gpu/drm/drm_atomic.c:29:
./include/drm/drm_fourcc.h:65:7: note: declared here
char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf);
^~~~~~~~~~~~~~~~~~~
Can you pls rebase onto drm-misc or linux-next or something?
Thanks, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the Intel-gfx
mailing list