Merge branch 'i2c-mux/for-current' of https://github.com/peda-r/i2c-mux into i2c/for-current
Pull bugfixes from the i2c mux subsubsystem: This fixes an old bug in resource cleanup on failure in i2c-mux-reg and a new log spamming bug from this merge window in the i2c-mux core.
This commit is contained in:
commit
fc9d0cd9ca
@ -395,18 +395,20 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
|
||||
if (force_nr) {
|
||||
priv->adap.nr = force_nr;
|
||||
ret = i2c_add_numbered_adapter(&priv->adap);
|
||||
dev_err(&parent->dev,
|
||||
"failed to add mux-adapter %u as bus %u (error=%d)\n",
|
||||
chan_id, force_nr, ret);
|
||||
if (ret < 0) {
|
||||
dev_err(&parent->dev,
|
||||
"failed to add mux-adapter %u as bus %u (error=%d)\n",
|
||||
chan_id, force_nr, ret);
|
||||
goto err_free_priv;
|
||||
}
|
||||
} else {
|
||||
ret = i2c_add_adapter(&priv->adap);
|
||||
dev_err(&parent->dev,
|
||||
"failed to add mux-adapter %u (error=%d)\n",
|
||||
chan_id, ret);
|
||||
}
|
||||
if (ret < 0) {
|
||||
kfree(priv);
|
||||
return ret;
|
||||
if (ret < 0) {
|
||||
dev_err(&parent->dev,
|
||||
"failed to add mux-adapter %u (error=%d)\n",
|
||||
chan_id, ret);
|
||||
goto err_free_priv;
|
||||
}
|
||||
}
|
||||
|
||||
WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj,
|
||||
@ -422,6 +424,10 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
|
||||
|
||||
muxc->adapter[muxc->num_adapters++] = &priv->adap;
|
||||
return 0;
|
||||
|
||||
err_free_priv:
|
||||
kfree(priv);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(i2c_mux_add_adapter);
|
||||
|
||||
|
@ -196,20 +196,25 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
mux->data.reg_size = resource_size(res);
|
||||
mux->data.reg = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(mux->data.reg))
|
||||
return PTR_ERR(mux->data.reg);
|
||||
if (IS_ERR(mux->data.reg)) {
|
||||
ret = PTR_ERR(mux->data.reg);
|
||||
goto err_put_parent;
|
||||
}
|
||||
}
|
||||
|
||||
if (mux->data.reg_size != 4 && mux->data.reg_size != 2 &&
|
||||
mux->data.reg_size != 1) {
|
||||
dev_err(&pdev->dev, "Invalid register size\n");
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto err_put_parent;
|
||||
}
|
||||
|
||||
muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values, 0, 0,
|
||||
i2c_mux_reg_select, NULL);
|
||||
if (!muxc)
|
||||
return -ENOMEM;
|
||||
if (!muxc) {
|
||||
ret = -ENOMEM;
|
||||
goto err_put_parent;
|
||||
}
|
||||
muxc->priv = mux;
|
||||
|
||||
platform_set_drvdata(pdev, muxc);
|
||||
@ -223,7 +228,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
|
||||
|
||||
ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class);
|
||||
if (ret)
|
||||
goto add_adapter_failed;
|
||||
goto err_del_mux_adapters;
|
||||
}
|
||||
|
||||
dev_dbg(&pdev->dev, "%d port mux on %s adapter\n",
|
||||
@ -231,8 +236,10 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
|
||||
|
||||
return 0;
|
||||
|
||||
add_adapter_failed:
|
||||
err_del_mux_adapters:
|
||||
i2c_mux_del_adapters(muxc);
|
||||
err_put_parent:
|
||||
i2c_put_adapter(parent);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user