pwm.c: remove surplus variable assignment
@@ -280,21 +280,18 @@ mraa_pwm_init(int pin)
mraa_pwm_context
mraa_pwm_init_raw(int chipin, int pin)
{
- mraa_result_t status = MRAA_SUCCESS;
-
mraa_pwm_context dev = mraa_pwm_init_internal(plat == NULL ? NULL : plat->adv_func , chipin, pin);
if (dev == NULL) {
syslog(LOG_CRIT, "pwm: Failed to allocate memory for context");
- status = MRAA_ERROR_NO_RESOURCES;
return NULL;
}
if (IS_FUNC_DEFINED(dev, pwm_init_raw_replace)) {
- status = dev->advance_func->pwm_init_raw_replace(dev, pin);
- if (status == MRAA_SUCCESS) {
+ if (dev->advance_func->pwm_init_raw_replace(dev, pin) == MRAA_SUCCESS) {
return dev;
} else {
- goto init_raw_cleanup;
+ free(dev);
+ return NULL;
}
}
@@ -329,14 +326,6 @@ mraa_pwm_init_raw(int chipin, int pin)
mraa_pwm_setup_duty_fp(dev);
-init_raw_cleanup:
- if (status != MRAA_SUCCESS) {
- if (dev != NULL) {
- free(dev);
- }
- return NULL;
- }
-
return dev;
}
