Commit 35e7aaab authored by Markus Schneider-Pargmann's avatar Markus Schneider-Pargmann Committed by Marc Kleine-Budde

can: tcan4x5x: Add error messages in probe

To be able to understand issues during probe easier, add error messages
if something fails.
Signed-off-by: default avatarMarkus Schneider-Pargmann <msp@baylibre.com>
Link: https://lore.kernel.org/all/20230728141923.162477-7-msp@baylibre.comSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 142c6dc6
...@@ -402,6 +402,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi) ...@@ -402,6 +402,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
/* Sanity check */ /* Sanity check */
if (freq < 20000000 || freq > TCAN4X5X_EXT_CLK_DEF) { if (freq < 20000000 || freq > TCAN4X5X_EXT_CLK_DEF) {
dev_err(&spi->dev, "Clock frequency is out of supported range %d\n",
freq);
ret = -ERANGE; ret = -ERANGE;
goto out_m_can_class_free_dev; goto out_m_can_class_free_dev;
} }
...@@ -420,16 +422,23 @@ static int tcan4x5x_can_probe(struct spi_device *spi) ...@@ -420,16 +422,23 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
/* Configure the SPI bus */ /* Configure the SPI bus */
spi->bits_per_word = 8; spi->bits_per_word = 8;
ret = spi_setup(spi); ret = spi_setup(spi);
if (ret) if (ret) {
dev_err(&spi->dev, "SPI setup failed %pe\n", ERR_PTR(ret));
goto out_m_can_class_free_dev; goto out_m_can_class_free_dev;
}
ret = tcan4x5x_regmap_init(priv); ret = tcan4x5x_regmap_init(priv);
if (ret) if (ret) {
dev_err(&spi->dev, "regmap init failed %pe\n", ERR_PTR(ret));
goto out_m_can_class_free_dev; goto out_m_can_class_free_dev;
}
ret = tcan4x5x_power_enable(priv->power, 1); ret = tcan4x5x_power_enable(priv->power, 1);
if (ret) if (ret) {
dev_err(&spi->dev, "Enabling regulator failed %pe\n",
ERR_PTR(ret));
goto out_m_can_class_free_dev; goto out_m_can_class_free_dev;
}
version_info = tcan4x5x_find_version(priv); version_info = tcan4x5x_find_version(priv);
if (IS_ERR(version_info)) { if (IS_ERR(version_info)) {
...@@ -438,16 +447,24 @@ static int tcan4x5x_can_probe(struct spi_device *spi) ...@@ -438,16 +447,24 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
} }
ret = tcan4x5x_get_gpios(mcan_class, version_info); ret = tcan4x5x_get_gpios(mcan_class, version_info);
if (ret) if (ret) {
dev_err(&spi->dev, "Getting gpios failed %pe\n", ERR_PTR(ret));
goto out_power; goto out_power;
}
ret = tcan4x5x_init(mcan_class); ret = tcan4x5x_init(mcan_class);
if (ret) if (ret) {
dev_err(&spi->dev, "tcan initialization failed %pe\n",
ERR_PTR(ret));
goto out_power; goto out_power;
}
ret = m_can_class_register(mcan_class); ret = m_can_class_register(mcan_class);
if (ret) if (ret) {
dev_err(&spi->dev, "Failed registering m_can device %pe\n",
ERR_PTR(ret));
goto out_power; goto out_power;
}
netdev_info(mcan_class->net, "TCAN4X5X successfully initialized.\n"); netdev_info(mcan_class->net, "TCAN4X5X successfully initialized.\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment