amdgpu/dc: remove pointless returns in the i2caux constructor paths. (v2)

There was lots of return true, and error checking that was never used
in these paths.

Just remove it all.

v2: I missed one return true.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Dave Airlie
2017-09-29 15:44:54 +10:00
committed by Alex Deucher
parent 4179cd8137
commit b08c3ca4e9
28 changed files with 100 additions and 246 deletions

View File

@@ -824,20 +824,11 @@ static const struct i2c_hw_engine_funcs i2c_hw_engine_funcs = {
dal_i2c_hw_engine_wait_on_operation_result,
};
static bool construct(
static void construct(
struct i2c_hw_engine_dce80 *engine,
const struct i2c_hw_engine_dce80_create_arg *arg)
{
if (arg->engine_id >= sizeof(ddc_setup_offset) / sizeof(int32_t))
return false;
if (arg->engine_id >= sizeof(ddc_speed_offset) / sizeof(int32_t))
return false;
if (!arg->reference_frequency)
return false;
if (!dal_i2c_hw_engine_construct(&engine->base, arg->ctx))
return false;
dal_i2c_hw_engine_construct(&engine->base, arg->ctx);
engine->base.base.base.funcs = &engine_funcs;
engine->base.base.funcs = &i2c_engine_funcs;
@@ -853,8 +844,6 @@ static bool construct(
engine->buffer_used_bytes = 0;
engine->transaction_count = 0;
engine->engine_keep_power_up_count = 1;
return true;
}
struct i2c_engine *dal_i2c_hw_engine_dce80_create(
@@ -867,6 +856,13 @@ struct i2c_engine *dal_i2c_hw_engine_dce80_create(
return NULL;
}
if ((arg->engine_id >= sizeof(ddc_setup_offset) / sizeof(int32_t)) ||
(arg->engine_id >= sizeof(ddc_speed_offset) / sizeof(int32_t)) ||
!arg->reference_frequency) {
BREAK_TO_DEBUGGER();
return NULL;
}
engine = kzalloc(sizeof(struct i2c_hw_engine_dce80), GFP_KERNEL);
if (!engine) {
@@ -874,12 +870,6 @@ struct i2c_engine *dal_i2c_hw_engine_dce80_create(
return NULL;
}
if (construct(engine, arg))
return &engine->base.base;
BREAK_TO_DEBUGGER();
kfree(engine);
return NULL;
construct(engine, arg);
return &engine->base.base;
}

View File

@@ -133,7 +133,7 @@ static const struct engine_funcs engine_funcs = {
.submit_request = dal_i2c_sw_engine_submit_request,
};
static bool construct(
static void construct(
struct i2c_sw_engine_dce80 *engine,
const struct i2c_sw_engine_dce80_create_arg *arg)
{
@@ -142,17 +142,12 @@ static bool construct(
arg_base.ctx = arg->ctx;
arg_base.default_speed = arg->default_speed;
if (!dal_i2c_sw_engine_construct(&engine->base, &arg_base)) {
BREAK_TO_DEBUGGER();
return false;
}
dal_i2c_sw_engine_construct(&engine->base, &arg_base);
engine->base.base.base.funcs = &engine_funcs;
engine->base.base.funcs = &i2c_engine_funcs;
engine->base.default_speed = arg->default_speed;
engine->engine_id = arg->engine_id;
return true;
}
struct i2c_engine *dal_i2c_sw_engine_dce80_create(
@@ -172,13 +167,7 @@ struct i2c_engine *dal_i2c_sw_engine_dce80_create(
return NULL;
}
if (construct(engine, arg))
return &engine->base.base;
BREAK_TO_DEBUGGER();
kfree(engine);
return NULL;
construct(engine, arg);
return &engine->base.base;
}

View File

@@ -187,7 +187,7 @@ static const struct i2caux_funcs i2caux_funcs = {
.acquire_aux_engine = dal_i2caux_acquire_aux_engine,
};
static bool construct(
static void construct(
struct i2caux_dce80 *i2caux_dce80,
struct dc_context *ctx)
{
@@ -207,10 +207,7 @@ static bool construct(
uint32_t i;
if (!dal_i2caux_construct(base, ctx)) {
BREAK_TO_DEBUGGER();
return false;
}
dal_i2caux_construct(base, ctx);
i2caux_dce80->base.funcs = &i2caux_funcs;
i2caux_dce80->i2c_hw_buffer_in_use = false;
@@ -269,8 +266,6 @@ static bool construct(
} while (i < ARRAY_SIZE(hw_aux_lines));
/* TODO Generic I2C SW and HW */
return true;
}
struct i2caux *dal_i2caux_dce80_create(
@@ -284,12 +279,6 @@ struct i2caux *dal_i2caux_dce80_create(
return NULL;
}
if (construct(i2caux_dce80, ctx))
return &i2caux_dce80->base;
BREAK_TO_DEBUGGER();
kfree(i2caux_dce80);
return NULL;
construct(i2caux_dce80, ctx);
return &i2caux_dce80->base;
}