lkml.org 
[lkml]   [2014]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] drivers/bus: Added Freescale Management Complex APIs


On 09/11/2014 01:45 PM, Joe Perches wrote:
>
>> diff --git a/drivers/bus/fsl-mc/dpmng.c b/drivers/bus/fsl-mc/dpmng.c
> []
>> +int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
>> +{
>> + struct mc_command cmd = { 0 };
>> + int err;
>> +
>> + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
>> + DPMNG_CMDSZ_GET_VERSION,
>> + MC_CMD_PRI_LOW, 0);
>> +
>> + err = mc_send_command(mc_io, &cmd);
>> + if (!err)
>> + DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
>> +
>> + return err;
>
> I think it better style to read when the
> failure case is handled immediately by
> a return or a "goto out" and the successful
> case code is at the same indent level
>
> err = mc_send_command_(etc...)
> if (err)
> return err;
>
> DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
>
> return 0;
> }
>
Ok, I'll change this as suggested in the next respin.

>> diff --git a/drivers/bus/fsl-mc/dprc.c b/drivers/bus/fsl-mc/dprc.c
>
>> +int dprc_get_container_id(struct fsl_mc_io *mc_io, int *container_id)
>> +{
>> + struct mc_command cmd = { 0 };
>> + int err;
>> +
>> + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID,
>> + DPRC_CMDSZ_GET_CONT_ID,
>> + MC_CMD_PRI_LOW, 0);
>> +
>> + err = mc_send_command(mc_io, &cmd);
>> + if (!err)
>> + DPRC_RSP_GET_CONTAINER_ID(cmd, *container_id);
>> +
>> + return err;
>> +}
>
> Same sort of thing as above.
> Actively fail on err and proceed at the same indent
> level on success.
>
Yes, I'll change all occurrences of this.


\
 
 \ /
  Last update: 2014-09-17 19:01    [W:0.175 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site