diff options
author | Simon Sandström <simon@nikanor.nu> | 2017-12-06 21:42:24 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-06 22:07:23 +0100 |
commit | 54fc95a7c59612263126c2eb4d46cf674095b63c (patch) | |
tree | d5b983f894b75757bb6d372cb6a97751254ce2ae /drivers/staging/pi433 | |
parent | 534a2610e1445689055cc9f4fbb55eb7002378ef (diff) | |
download | op-kernel-dev-54fc95a7c59612263126c2eb4d46cf674095b63c.zip op-kernel-dev-54fc95a7c59612263126c2eb4d46cf674095b63c.tar.gz |
staging: pi433: Remove SET_CHECKED usage from pi433_probe
SET_CHECKED returns from the function on failure and in pi433_probe it is
necessary to free the GPIOs and the device on failure.
Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/pi433')
-rw-r--r-- | drivers/staging/pi433/pi433_if.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 688d0cf..55ed45f 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1124,13 +1124,27 @@ static int pi433_probe(struct spi_device *spi) } /* setup the radio module */ - SET_CHECKED(rf69_set_mode (spi, standby)); - SET_CHECKED(rf69_set_data_mode (spi, DATAMODUL_MODE_PACKET)); - SET_CHECKED(rf69_enable_amplifier(spi, MASK_PALEVEL_PA0)); - SET_CHECKED(rf69_disable_amplifier(spi, MASK_PALEVEL_PA1)); - SET_CHECKED(rf69_disable_amplifier(spi, MASK_PALEVEL_PA2)); - SET_CHECKED(rf69_set_output_power_level (spi, 13)); - SET_CHECKED(rf69_set_antenna_impedance (spi, fiftyOhm)); + retval = rf69_set_mode(spi, standby); + if (retval < 0) + goto minor_failed; + retval = rf69_set_data_mode(spi, DATAMODUL_MODE_PACKET); + if (retval < 0) + goto minor_failed; + retval = rf69_enable_amplifier(spi, MASK_PALEVEL_PA0); + if (retval < 0) + goto minor_failed; + retval = rf69_disable_amplifier(spi, MASK_PALEVEL_PA1); + if (retval < 0) + goto minor_failed; + retval = rf69_disable_amplifier(spi, MASK_PALEVEL_PA2); + if (retval < 0) + goto minor_failed; + retval = rf69_set_output_power_level(spi, 13); + if (retval < 0) + goto minor_failed; + retval = rf69_set_antenna_impedance(spi, fiftyOhm); + if (retval < 0) + goto minor_failed; /* determ minor number */ retval = pi433_get_minor(device); |