Commit fb7544d7 authored by Russell King's avatar Russell King

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 7d2eadc9
...@@ -1169,7 +1169,7 @@ tda998x_encoder_init(struct i2c_client *client, ...@@ -1169,7 +1169,7 @@ tda998x_encoder_init(struct i2c_client *client,
struct drm_encoder_slave *encoder_slave) struct drm_encoder_slave *encoder_slave)
{ {
struct tda998x_priv *priv; struct tda998x_priv *priv;
int ret; int rev_lo, rev_hi, ret;
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -1198,11 +1198,14 @@ tda998x_encoder_init(struct i2c_client *client, ...@@ -1198,11 +1198,14 @@ tda998x_encoder_init(struct i2c_client *client,
tda998x_reset(priv); tda998x_reset(priv);
/* read version: */ /* read version: */
ret = reg_read(priv, REG_VERSION_LSB) | rev_lo = reg_read(priv, REG_VERSION_LSB);
(reg_read(priv, REG_VERSION_MSB) << 8); rev_hi = reg_read(priv, REG_VERSION_MSB);
if (ret < 0) if (rev_lo < 0 || rev_hi < 0) {
ret = rev_lo < 0 ? rev_lo : rev_hi;
goto fail; goto fail;
priv->rev = ret; }
priv->rev = rev_lo | rev_hi << 8;
/* mask off feature bits: */ /* mask off feature bits: */
priv->rev &= ~0x30; /* not-hdcp and not-scalar bit */ priv->rev &= ~0x30; /* not-hdcp and not-scalar bit */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment