Re: [PATCH 10/12] usb: typec: driver for Pericom PI3USB30532 Type-C cross switch

Andy Shevchenko
2018-02-16T13:34:02Z

On Fri, Feb 16, 2018 at 12:47 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> Add a driver for the Pericom PI3USB30532 Type-C cross switch /
> mux chip found on some devices with a Type-C port.

> +static int pi3usb30532_set_conf(struct pi3usb30532 *pi, u8 new_conf)
> +{
> + int ret = 0;
> +
> + if (pi->conf == new_conf)
> + return 0;
> +
> + ret = i2c_smbus_write_byte_data(pi->client, PI3USB30532_CONF, new_conf);

> + if (ret == 0)
> + pi->conf = new_conf;
> + else
> + dev_err(&pi->client->dev, "Error writing conf: %d\n", ret);

Usual pattern, please.

if (ret) {
...
return ret;
}

return 0;

> +
> + return ret;
> +}

--
With Best Regards,
Andy Shevchenko