i2c/mux: (pinctrl) Fix probe error path
Subsystems (2)
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.
Signed-off-by Guenter Roeck <[email protected]>
--- drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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;
Signature · 1 line
1.7.9.7
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.
Signed-off-by Guenter Roeck <[email protected]>--- drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/muxes/i2c-mux-pinctrl.c +0
-0
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