OSDN Git Service

Merge branch 'drm-tda9950-fixes' of git://git.armlinux.org.uk/~rmk/linux-arm into...
authorDave Airlie <airlied@redhat.com>
Thu, 4 Oct 2018 00:28:27 +0000 (10:28 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 4 Oct 2018 00:32:14 +0000 (10:32 +1000)
two tda9950 fixes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Russell King <rmk@armlinux.org.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181001162948.GA9508@rmk-PC.armlinux.org.uk
1  2 
drivers/gpu/drm/i2c/tda9950.c

@@@ -76,12 -76,9 +76,12 @@@ struct tda9950_priv 
  static int tda9950_write_range(struct i2c_client *client, u8 addr, u8 *p, int cnt)
  {
        struct i2c_msg msg;
 -      u8 buf[cnt + 1];
 +      u8 buf[CEC_MAX_MSG_SIZE + 3];
        int ret;
  
 +      if (WARN_ON(cnt > sizeof(buf) - 1))
 +              return -EINVAL;
 +
        buf[0] = addr;
        memcpy(buf + 1, p, cnt);
  
@@@ -191,7 -188,8 +191,8 @@@ static irqreturn_t tda9950_irq(int irq
                        break;
                }
                /* TDA9950 executes all retries for us */
-               tx_status |= CEC_TX_STATUS_MAX_RETRIES;
+               if (tx_status != CEC_TX_STATUS_OK)
+                       tx_status |= CEC_TX_STATUS_MAX_RETRIES;
                cec_transmit_done(priv->adap, tx_status, arb_lost_cnt,
                                  nack_cnt, 0, err_cnt);
                break;
@@@ -310,7 -308,7 +311,7 @@@ static void tda9950_release(struct tda9
        /* Wait up to .5s for it to signal non-busy */
        do {
                csr = tda9950_read(client, REG_CSR);
-               if (!(csr & CSR_BUSY) || --timeout)
+               if (!(csr & CSR_BUSY) || !--timeout)
                        break;
                msleep(10);
        } while (1);