lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1410461116.9942.15.camel@joe-AO725>
Date:	Thu, 11 Sep 2014 11:45:16 -0700
From:	Joe Perches <joe@...ches.com>
To:	"J. German Rivera" <German.Rivera@...escale.com>
Cc:	gregkh@...uxfoundation.org, arnd@...db.de,
	linux-kernel@...r.kernel.org, stuart.yoder@...escale.com,
	Kim.Phillips@...escale.com, scottwood@...escale.com, agraf@...e.de,
	linuxppc-release@...ux.freescale.net
Subject: Re: [PATCH 1/4] drivers/bus: Added Freescale Management Complex APIs

On Thu, 2014-09-11 at 12:34 -0500, J. German Rivera wrote:
> APIs to access the Management Complex (MC) hardware
> module of Freescale LS2 SoCs. This patch includes
> APIs to check the MC firmware version and to manipulate
> DPRC objects in the MC.

> 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;
}

> 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.

> +
> +int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *dprc_handle)
> +{
> +	int err;
> +	struct mc_command cmd = { 0 };
> +
> +	cmd.header = mc_encode_cmd_header(MC_DPRC_CMDID_OPEN,
> +					  MC_CMD_OPEN_SIZE, MC_CMD_PRI_LOW, 0);
> +
> +	DPRC_CMD_OPEN(cmd, container_id);
> +
> +	err = mc_send_command(mc_io, &cmd);
> +	if (!err)
> +		*dprc_handle = MC_CMD_HDR_READ_AUTHID(cmd.header);
> +
> +	return err;
> +}

etc.

I didn't read any more.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ