Skip to content

Commit e8ba259

Browse files
nunojsabroonie
authored andcommitted
spi: xcomm: make use of devm_spi_alloc_host()
Use devm_spi_alloc_host() so that there's no need to call spi_controller_put() in the error path. Signed-off-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 5211070 commit e8ba259

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi-xcomm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static int spi_xcomm_probe(struct i2c_client *i2c)
248248
struct spi_controller *host;
249249
int ret;
250250

251-
host = spi_alloc_host(&i2c->dev, sizeof(*spi_xcomm));
251+
host = devm_spi_alloc_host(&i2c->dev, sizeof(*spi_xcomm));
252252
if (!host)
253253
return -ENOMEM;
254254

@@ -265,7 +265,7 @@ static int spi_xcomm_probe(struct i2c_client *i2c)
265265

266266
ret = devm_spi_register_controller(&i2c->dev, host);
267267
if (ret < 0)
268-
spi_controller_put(host);
268+
return ret;
269269

270270
return spi_xcomm_gpio_add(spi_xcomm);
271271
}

0 commit comments

Comments
 (0)