diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-02-02 16:18:24 (GMT) |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-02-13 19:41:37 (GMT) |
commit | fb7544d7732f780df989fabf31c5852be953daad (patch) | |
tree | 963f13b8a7bf16ecf8cb6028cb7d968ba5eed503 /drivers/gpu/drm/i2c | |
parent | 7d2eadc9b9d4eacc6aa8cc0cb33e05b5a6d30256 (diff) | |
download | linux-fb7544d7732f780df989fabf31c5852be953daad.tar.xz |
drm/i2c: tda998x: clean up error chip version checking
This is a nicer way, and results in proper return codes should the
read of the MSB version register fail.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/i2c')
-rw-r--r-- | drivers/gpu/drm/i2c/tda998x_drv.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 9bd336c..19f4182 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1169,7 +1169,7 @@ tda998x_encoder_init(struct i2c_client *client, struct drm_encoder_slave *encoder_slave) { struct tda998x_priv *priv; - int ret; + int rev_lo, rev_hi, ret; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) @@ -1198,11 +1198,14 @@ tda998x_encoder_init(struct i2c_client *client, tda998x_reset(priv); /* read version: */ - ret = reg_read(priv, REG_VERSION_LSB) | - (reg_read(priv, REG_VERSION_MSB) << 8); - if (ret < 0) + rev_lo = reg_read(priv, REG_VERSION_LSB); + rev_hi = reg_read(priv, REG_VERSION_MSB); + if (rev_lo < 0 || rev_hi < 0) { + ret = rev_lo < 0 ? rev_lo : rev_hi; goto fail; - priv->rev = ret; + } + + priv->rev = rev_lo | rev_hi << 8; /* mask off feature bits: */ priv->rev &= ~0x30; /* not-hdcp and not-scalar bit */ |