aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i2c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-02-02 11:18:24 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-02-13 14:41:37 -0500
commitfb7544d7732f780df989fabf31c5852be953daad (patch)
tree963f13b8a7bf16ecf8cb6028cb7d968ba5eed503 /drivers/gpu/drm/i2c
parent7d2eadc9b9d4eacc6aa8cc0cb33e05b5a6d30256 (diff)
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.c13
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 9bd336cdb734..19f418246e7b 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,
1169 struct drm_encoder_slave *encoder_slave) 1169 struct drm_encoder_slave *encoder_slave)
1170{ 1170{
1171 struct tda998x_priv *priv; 1171 struct tda998x_priv *priv;
1172 int ret; 1172 int rev_lo, rev_hi, ret;
1173 1173
1174 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 1174 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
1175 if (!priv) 1175 if (!priv)
@@ -1198,11 +1198,14 @@ tda998x_encoder_init(struct i2c_client *client,
1198 tda998x_reset(priv); 1198 tda998x_reset(priv);
1199 1199
1200 /* read version: */ 1200 /* read version: */
1201 ret = reg_read(priv, REG_VERSION_LSB) | 1201 rev_lo = reg_read(priv, REG_VERSION_LSB);
1202 (reg_read(priv, REG_VERSION_MSB) << 8); 1202 rev_hi = reg_read(priv, REG_VERSION_MSB);
1203 if (ret < 0) 1203 if (rev_lo < 0 || rev_hi < 0) {
1204 ret = rev_lo < 0 ? rev_lo : rev_hi;
1204 goto fail; 1205 goto fail;
1205 priv->rev = ret; 1206 }
1207
1208 priv->rev = rev_lo | rev_hi << 8;
1206 1209
1207 /* mask off feature bits: */ 1210 /* mask off feature bits: */
1208 priv->rev &= ~0x30; /* not-hdcp and not-scalar bit */ 1211 priv->rev &= ~0x30; /* not-hdcp and not-scalar bit */