>>>>> "JD" == Jean Delvare <khali@xxxxxxxxxxxx> writes: JD> gpio_direction_output() may fail, check for that and deal with it JD> appropriately. Also log an error message if gpio_request() fails. JD> Signed-off-by: Jean Delvare <khali@xxxxxxxxxxxx> JD> Cc: Peter Korsgaard <peter.korsgaard@xxxxxxxxx> JD> Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx> JD> --- JD> drivers/i2c/muxes/i2c-mux-gpio.c | 17 ++++++++++++++--- JD> 1 file changed, 14 insertions(+), 3 deletions(-) JD> --- linux-3.7.orig/drivers/i2c/muxes/i2c-mux-gpio.c 2012-12-15 14:52:47.368991730 +0100 JD> +++ linux-3.7/drivers/i2c/muxes/i2c-mux-gpio.c 2013-03-03 14:27:21.003905620 +0100 JD> @@ -123,10 +123,21 @@ static int __devinit i2c_mux_gpio_probe( JD> for (i = 0; i < pdata->n_gpios; i++) { JD> ret = gpio_request(gpio_base + pdata->gpios[i], "i2c-mux-gpio"); JD> - if (ret) JD> + if (ret) { JD> + dev_err(&pdev->dev, "Failed to request GPIO %d\n", JD> + pdata->gpios[i]); JD> goto err_request_gpio; JD> - gpio_direction_output(gpio_base + pdata->gpios[i], JD> - initial_state & (1 << i)); JD> + } JD> + JD> + ret = gpio_direction_output(gpio_base + pdata->gpios[i], JD> + initial_state & (1 << i)); JD> + if (ret) { JD> + dev_err(&pdev->dev, JD> + "Failed to set direction of GPIO %d to output\n", JD> + pdata->gpios[i]); JD> + i++; JD> + goto err_request_gpio; The i++ is a bit nonobvious, so a comment would be good. Other than that it looks fine. Acked-by: Peter Korsgaard <peter.korsgaard@xxxxxxxxx> -- Sorry about disclaimer - It's out of my control. Bye, Peter Korsgaard DISCLAIMER: Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you. -- 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