brcm2708: update linux 4.4 patches to latest version
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0453-drm-vc4-clean-up-error-exit-path-on-failed-dpi_conne.patch
1 From 2092b669dd8d4c87cbbf107fd63fe2050ec5b4aa Mon Sep 17 00:00:00 2001
2 From: Colin Ian King <colin.king@canonical.com>
3 Date: Thu, 2 Jun 2016 10:38:29 +0100
4 Subject: [PATCH] drm/vc4: clean up error exit path on failed dpi_connector
5 allocation
6
7 There is redundant code in the clean up exit path when dpi_connector
8 fails to be allocated. The current code checks if connector is NULL
9 before destroying it, in fact, connector is NULL at this point so
10 the check is redundant and can be removed. The final clean up is
11 that we can remove the goto fail with a simple return and the unused
12 variable ret.
13
14 Signed-off-by: Colin Ian King <colin.king@canonical.com>
15 Reviewed-by: Eric Anholt <eric@anholt.net>
16 (cherry picked from commit a9402dfe17bddeee5c72943385eaa13c39f106f7)
17 ---
18 drivers/gpu/drm/vc4/vc4_dpi.c | 14 +++-----------
19 1 file changed, 3 insertions(+), 11 deletions(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_dpi.c
22 +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
23 @@ -236,14 +236,12 @@ static struct drm_connector *vc4_dpi_con
24 {
25 struct drm_connector *connector = NULL;
26 struct vc4_dpi_connector *dpi_connector;
27 - int ret = 0;
28
29 dpi_connector = devm_kzalloc(dev->dev, sizeof(*dpi_connector),
30 GFP_KERNEL);
31 - if (!dpi_connector) {
32 - ret = -ENOMEM;
33 - goto fail;
34 - }
35 + if (!dpi_connector)
36 + return ERR_PTR(-ENOMEM);
37 +
38 connector = &dpi_connector->base;
39
40 dpi_connector->encoder = dpi->encoder;
41 @@ -260,12 +258,6 @@ static struct drm_connector *vc4_dpi_con
42 drm_mode_connector_attach_encoder(connector, dpi->encoder);
43
44 return connector;
45 -
46 - fail:
47 - if (connector)
48 - vc4_dpi_connector_destroy(connector);
49 -
50 - return ERR_PTR(ret);
51 }
52
53 static const struct drm_encoder_funcs vc4_dpi_encoder_funcs = {