Geert Uytterhoeven 5ad773f9a9 drm/bridge: dumb-vga-dac: Fix dereferencing -ENODEV DDC channel
If the VGA connector has no DDC channel, an error pointer will be
dereferenced, e.g. on Salvator-XS:

    Unable to handle kernel NULL pointer dereference at virtual address 000000000000017d
    ...
    Call trace:
     sysfs_do_create_link_sd.isra.0+0x40/0x108
     sysfs_create_link+0x20/0x40
     drm_sysfs_connector_add+0xa8/0xc8
     drm_connector_register.part.3+0x54/0xb0
     drm_connector_register_all+0xb0/0xd0
     drm_modeset_register_all+0x54/0x88
     drm_dev_register+0x18c/0x1d8
     rcar_du_probe+0xe4/0x150
     ...

This happens because vga->ddc either contains a valid DDC channel
pointer, or -ENODEV, and drm_connector_init_with_ddc() expects a valid
DDC channel pointer, or NULL.

Fix this by resetting vga->ddc to NULL in case of -ENODEV, and replacing
the existing error checks by non-NULL checks.
This is similar to what the HDMI connector driver does.

Fixes: a4f9087e85de141e ("drm/bridge: dumb-vga-dac: Provide ddc symlink in connector sysfs directory")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190813093046.4976-1-geert+renesas@glider.be
2019-08-14 16:44:04 +02:00
..
2019-07-22 21:24:10 +02:00
2019-08-06 08:21:53 +02:00
2019-07-22 21:24:10 +02:00
2019-08-06 09:20:58 +02:00
2019-06-19 12:07:29 +02:00
2019-07-22 21:24:10 +02:00
2019-07-17 12:52:55 +02:00
2019-06-25 00:10:24 +02:00
2019-06-30 09:48:05 +02:00
2019-07-22 21:24:10 +02:00
2019-08-09 09:15:05 +02:00
2019-07-17 12:52:55 +02:00
2019-07-22 21:24:10 +02:00
2019-07-15 18:11:31 +02:00
2019-07-17 12:52:55 +02:00
2019-07-22 21:24:10 +02:00
2019-07-15 18:11:30 +02:00
2019-07-17 12:52:55 +02:00
2019-07-25 17:35:20 +02:00
2019-07-15 18:11:30 +02:00
2019-07-15 18:11:30 +02:00
2019-07-22 21:24:10 +02:00
2019-06-19 12:07:29 +02:00
2019-07-22 21:24:10 +02:00
2019-06-19 12:07:29 +02:00
2019-07-22 21:24:10 +02:00
2019-07-22 21:24:10 +02:00
2019-06-19 12:07:29 +02:00
2019-07-25 10:45:07 +02:00
2019-07-22 21:24:10 +02:00
2019-06-19 12:07:29 +02:00
2019-06-19 12:07:29 +02:00
2019-07-31 15:17:03 +02:00
2019-07-31 15:17:03 +02:00