@@ -1272,19 +1272,25 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
1272
1272
/* Check for some optional GPIO controls */
1273
1273
slot -> vsd = devm_gpiod_get_index_optional (host -> dev , "vsd" ,
1274
1274
id , GPIOD_OUT_LOW );
1275
- if (IS_ERR (slot -> vsd ))
1276
- return dev_err_probe (host -> dev , PTR_ERR (slot -> vsd ),
1275
+ if (IS_ERR (slot -> vsd )) {
1276
+ r = dev_err_probe (host -> dev , PTR_ERR (slot -> vsd ),
1277
1277
"error looking up VSD GPIO\n" );
1278
+ goto err_free_host ;
1279
+ }
1278
1280
slot -> vio = devm_gpiod_get_index_optional (host -> dev , "vio" ,
1279
1281
id , GPIOD_OUT_LOW );
1280
- if (IS_ERR (slot -> vio ))
1281
- return dev_err_probe (host -> dev , PTR_ERR (slot -> vio ),
1282
+ if (IS_ERR (slot -> vio )) {
1283
+ r = dev_err_probe (host -> dev , PTR_ERR (slot -> vio ),
1282
1284
"error looking up VIO GPIO\n" );
1285
+ goto err_free_host ;
1286
+ }
1283
1287
slot -> cover = devm_gpiod_get_index_optional (host -> dev , "cover" ,
1284
1288
id , GPIOD_IN );
1285
- if (IS_ERR (slot -> cover ))
1286
- return dev_err_probe (host -> dev , PTR_ERR (slot -> cover ),
1289
+ if (IS_ERR (slot -> cover )) {
1290
+ r = dev_err_probe (host -> dev , PTR_ERR (slot -> cover ),
1287
1291
"error looking up cover switch GPIO\n" );
1292
+ goto err_free_host ;
1293
+ }
1288
1294
1289
1295
host -> slots [id ] = slot ;
1290
1296
@@ -1344,6 +1350,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
1344
1350
device_remove_file (& mmc -> class_dev , & dev_attr_slot_name );
1345
1351
err_remove_host :
1346
1352
mmc_remove_host (mmc );
1353
+ err_free_host :
1347
1354
mmc_free_host (mmc );
1348
1355
return r ;
1349
1356
}
0 commit comments