Is this a good function for I2C receive? I'm trying to fix my I2C code:

Is the following function correct because it has multiple returns. I don't know if that would work.

uint8_t I2C_rx(uint8_t ack_rx)
{
    uint8_t i;
    if (ack_rx)
    {
        TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWEN)|(1&lt;&lt;TWEA); // sending ACK
        while (!(TWCR &amp; (1&lt;&lt;TWINT)));
        return TWDR;
    }
    else
    {
        TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWEN);           // sending NACK
        while (!(TWCR &amp; (1&lt;&lt;TWINT)));
        return TWDR;
    }
}
No problem with multiple returns but it could be reduced to:

uint8_t I2C_rx(bool ack_rx)
{
  uint8_t cr = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);
  if (ack_rx) cr |= (1&lt;&lt;TWEA);
  TWCR = cr;
  while (!(TWCR &amp; (1&lt;&lt;TWINT)));
  return TWDR;
}


or

uint8_t I2C_rx(bool ack_rx)
{
  TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN) | (ack_rx&lt;&lt;TWEA);
  while (!(TWCR &amp; (1&lt;&lt;TWINT)));
  return TWDR;
}


Cheers!