Skip to contentSkip to conversation

i2c/mux: (pinctrl) Fix probe error path

PATCH In review Guenter Roeck 2 participants 2 messages Nov 11, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c/mux: (pinctrl) Fix probe error path

When allocating the memory for i2c busses, the code checked the wrong variable and thus never detected if there was a memory error.

---
 drivers/i2c/muxes/i2c-mux-pinctrl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-pinctrl.c +1 -1
index 5f097f3..7fa5b24 100644
@@ -169,7 +169,7 @@ static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev)
 	mux->busses = devm_kzalloc(&pdev->dev,
 				   sizeof(mux->busses) * mux->pdata->bus_count,
 				   GFP_KERNEL);
-	if (!mux->states) {
+	if (!mux->busses) {
 		dev_err(&pdev->dev, "Cannot allocate busses\n");
 		ret = -ENOMEM;
 		goto err;
Signature · 1 line
1.7.9.7
#2 lore raw
In reply to a message not in the archive
Quoted 13 lines · Guenter Roeck

When allocating the memory for i2c busses, the code checked the wrong variable and thus never detected if there was a memory error.

---
 drivers/i2c/muxes/i2c-mux-pinctrl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-pinctrl.c +0 -0
index 5f097f3..7fa5b24 100644

drivers/i2c/muxes/i2c-mux-pinctrl.c static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev) · line 175

Quoted 8 lines
drivers/i2c/muxes/i2c-mux-pinctrl.c +1 -1
@@ -169,7 +169,7 @@ static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev)
 	mux->busses = devm_kzalloc(&pdev->dev,
 				   sizeof(mux->busses) * mux->pdata->bus_count,
 				   GFP_KERNEL);
-	if (!mux->states) {
+	if (!mux->busses) {
 		dev_err(&pdev->dev, "Cannot allocate busses\n");
 		ret = -ENOMEM;
 		goto err;

Good catch. Applied, thanks. Will send to stable too.

Signature · 1 line
Jean Delvare