[Intel-gfx] [PATCH] drm/i915: propagate errors from intel_dp_init_connector
Daniel Vetter
daniel at ffwll.ch
Mon Jun 10 22:13:05 CEST 2013
On Mon, Jun 10, 2013 at 9:59 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Mon, Jun 10, 2013 at 02:19:45PM -0300, Paulo Zanoni wrote:
>> - intel_dp_init_connector(intel_dig_port, dp_connector);
>> + /* May fail if it's an eDP connector that's disconnected. */
>> + if (!intel_dp_init_connector(intel_dig_port, dp_connector)) {
>> + intel_ddi_destroy(encoder);
>> + intel_dp_destroy(&dp_connector->base);
>> + return;
>> + }
>
> You should not need to export intel_dp_destroy() ever. Better would be
> for init to undo anything it allocates upon failure and here we just
> kfree(dp_connector). In particular, intel_dp_destroy() is wrong here as
> you have no idea if init returned at an appropriate juntion to make
> calling that function safe.
Good point, I guess we could extract an __dp_destroy function which
avoids the kfree, use that in appropriate places and do the kfree in
the two functions that allocated the struct. Patch dropped again.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list