From: Adriana Reus <adriana.reus@xxxxxxxxx> Add a check in i2c_mux_master_xfer before calling the select callback. This is necessary so that NULL callbacks can be safely registered. Signed-off-by: Adriana Reus <adriana.reus@xxxxxxxxx> Signed-off-by: Daniel Baluta <daniel.baluta@xxxxxxxxx> --- drivers/i2c/i2c-mux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 00fc5b1..74d1700 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c @@ -46,11 +46,12 @@ static int i2c_mux_master_xfer(struct i2c_adapter *adap, { struct i2c_mux_priv *priv = adap->algo_data; struct i2c_adapter *parent = priv->parent; - int ret; + int ret = 0; /* Switch to the right mux port and perform the transfer. */ - ret = priv->select(parent, priv->mux_priv, priv->chan_id); + if (priv->select) + ret = priv->select(parent, priv->mux_priv, priv->chan_id); if (ret >= 0) ret = __i2c_transfer(parent, msgs, num); if (priv->deselect) @@ -66,11 +67,12 @@ static int i2c_mux_smbus_xfer(struct i2c_adapter *adap, { struct i2c_mux_priv *priv = adap->algo_data; struct i2c_adapter *parent = priv->parent; - int ret; + int ret = 0; /* Select the right mux port and perform the transfer. */ - ret = priv->select(parent, priv->mux_priv, priv->chan_id); + if (priv->select) + ret = priv->select(parent, priv->mux_priv, priv->chan_id); if (ret >= 0) ret = parent->algo->smbus_xfer(parent, addr, flags, read_write, command, size, data); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html