diff options
author | Jani Nikula <jani.nikula@intel.com> | 2017-09-28 11:21:58 +0300 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2017-10-10 09:05:31 +0300 |
commit | a87145ca56d14fc4b0bce68c18a5fecb01a09540 (patch) | |
tree | 20ede147b1718a54281db7af90df167683f632b9 /drivers/gpu/drm/i915/intel_bios.c | |
parent | 348e4058ebf53904e817eec7a1b25327143c2ed2 (diff) | |
download | linux-a87145ca56d14fc4b0bce68c18a5fecb01a09540.tar.xz |
drm/i915/bios: refactor parse general definitions
Early return on failures. Rename the variable for later merging with
parse_device_mappings().
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/785abb904a572752fec68d90d34efeb67774dc1f.1506586821.git.jani.nikula@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_bios.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_bios.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 0a1159761ffd..22924612c680 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c @@ -435,21 +435,27 @@ static void parse_general_definitions(struct drm_i915_private *dev_priv, const struct bdb_header *bdb) { - const struct bdb_general_definitions *general; - - general = find_section(bdb, BDB_GENERAL_DEFINITIONS); - if (general) { - u16 block_size = get_blocksize(general); - if (block_size >= sizeof(*general)) { - int bus_pin = general->crt_ddc_gmbus_pin; - DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin); - if (intel_gmbus_is_valid_pin(dev_priv, bus_pin)) - dev_priv->vbt.crt_ddc_pin = bus_pin; - } else { - DRM_DEBUG_KMS("BDB_GD too small (%d). Invalid.\n", - block_size); - } + const struct bdb_general_definitions *defs; + u16 block_size; + int bus_pin; + + defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); + if (!defs) { + DRM_DEBUG_KMS("General definitions block not found\n"); + return; + } + + block_size = get_blocksize(defs); + if (block_size < sizeof(*defs)) { + DRM_DEBUG_KMS("General definitions block too small (%u)\n", + block_size); + return; } + + bus_pin = defs->crt_ddc_gmbus_pin; + DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin); + if (intel_gmbus_is_valid_pin(dev_priv, bus_pin)) + dev_priv->vbt.crt_ddc_pin = bus_pin; } static const struct child_device_config * |