"pad_num does not match num_chipselect(%d != %d)\n",
mdata->pad_num, master->num_chipselect);
ret = -EINVAL;
--- - goto err_put_master;
+++ + goto err_disable_runtime_pm;
}
-- - for (i = 0; i < master->num_chipselect; i++) {
-- - ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i],
-- - dev_name(&pdev->dev));
-- - if (ret) {
-- - dev_err(&pdev->dev,
-- - "can't get CS GPIO %i\n", i);
-- - goto err_put_master;
++ + if (!master->cs_gpios && master->num_chipselect > 1) {
++ + dev_err(&pdev->dev,
++ + "cs_gpios not specified and num_chipselect > 1\n");
++ + ret = -EINVAL;
- goto err_put_master;
+++ + goto err_disable_runtime_pm;
++ + }
++ +
++ + if (master->cs_gpios) {
++ + for (i = 0; i < master->num_chipselect; i++) {
++ + ret = devm_gpio_request(&pdev->dev,
++ + master->cs_gpios[i],
++ + dev_name(&pdev->dev));
++ + if (ret) {
++ + dev_err(&pdev->dev,
++ + "can't get CS GPIO %i\n", i);
- goto err_put_master;
+++ + goto err_disable_runtime_pm;
++ + }
}
}
}