mmc_gpio_request_ro() doesn't store the requested gpio in ctx->ro_gpio. As a result, subsequent calls to mmc_gpio_get_ro() will always fail with -ENOSYS because the gpio number isn't available to that function.
Unified · Split
| @@ -100,7 +100,13 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio) · 99 unmodified lines | ||
| 100 | 100 | |
| 101 | 101 | ctx = host->slot.handler_priv; |
| 102 | 102 | |
| 103 | − return gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label); | |
| 103 | + ret = gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label); | |
| 104 | + if (ret < 0) | |
| 105 | + return ret; | |
| 106 | + | |
| 107 | + ctx->ro_gpio = gpio; | |
| 108 | + | |
| 109 | + return 0; | |
| 104 | 110 | } |
| 105 | 111 | EXPORT_SYMBOL(mmc_gpio_request_ro); |
| 106 | 112 | |