Skip to content

Commit

Permalink
iio: adc: ad9361: Fix ad9361_set_trx_clock_chain()
Browse files Browse the repository at this point in the history
ad9361_dig_tune() shouldn't be called if conv is not available. This
situation occurs when ad9361_setup() is called by ad9361_probe()
(axi_converver is not yet registered using ad9361_register_axi_converter).

Signed-off-by: Dragos Bogdan <[email protected]>
  • Loading branch information
dbogdan authored and commodo committed Feb 18, 2020
1 parent f333036 commit 76ae514
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/iio/adc/ad9361.c
Original file line number Diff line number Diff line change
Expand Up @@ -4073,6 +4073,7 @@ static int ad9361_set_trx_clock_chain(struct ad9361_rf_phy *phy,
{
struct device *dev = &phy->spi->dev;
struct ad9361_rf_phy_state *st = phy->state;
struct axiadc_converter *conv = spi_get_drvdata(phy->spi);
int ret, i, j, n;

dev_dbg(&phy->spi->dev, "%s", __func__);
Expand Down Expand Up @@ -4142,12 +4143,12 @@ static int ad9361_set_trx_clock_chain(struct ad9361_rf_phy *phy,

if ((!phy->pdata->dig_interface_tune_fir_disable &&
!(st->bypass_tx_fir && st->bypass_rx_fir)) &&
!phy->pdata->bb_clk_change_dig_tune_en)
!phy->pdata->bb_clk_change_dig_tune_en && conv)
ret = ad9361_dig_tune(phy, 0, SKIP_STORE_RESULT);
if (ret < 0)
return ret;

if (phy->pdata->bb_clk_change_dig_tune_en)
if (phy->pdata->bb_clk_change_dig_tune_en && conv)
ret = ad9361_dig_tune(phy, 0, 0);
if (ret < 0)
return ret;
Expand Down

0 comments on commit 76ae514

Please sign in to comment.