public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eugeniu Rosca <roscaeugeniu@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 7/7] cmd: Add bind/unbind commands to bind a device to a driver from the command line
Date: Wed, 11 Jul 2018 22:59:51 +0200	[thread overview]
Message-ID: <20180711205951.GA25014@x230> (raw)
In-Reply-To: <1529670334-21974-8-git-send-email-jjhiblot@ti.com>

Hi,

On Fri, Jun 22, 2018 at 02:25:34PM +0200, Jean-Jacques Hiblot wrote:
> +static int do_bind_unbind(cmd_tbl_t *cmdtp, int flag, int argc,
> +			  char * const argv[])
> +{
> +	int ret;
> +	bool bind;
> +	bool by_node;
> +
> +	if (argc < 2)
> +		return CMD_RET_USAGE;
> +
> +	bind = (argv[0][0] == 'b');
> +	by_node = (argv[1][0] == '/');
> +
> +	if (by_node && bind) {
> +		if (argc != 3)
> +			return CMD_RET_USAGE;
> +		ret = bind_by_node_path(argv[1], argv[2]);
> +	} else if (by_node && !bind) {
> +		if (argc != 2)
> +			return CMD_RET_USAGE;
> +		ret = unbind_by_node_path(argv[1]);
> +	} else if (!by_node && bind) {
> +		int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
> +
> +		if (argc != 4)
> +			return CMD_RET_USAGE;
> +		ret = bind_by_class_index(argv[1], index, argv[3]);
> +	} else if (!by_node && !bind) {
> +		int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
> +
> +		if (argc == 3)
> +			ret = unbind_by_class_index(argv[1], index);
> +		else if (argc == 4)
> +			ret = unbind_child_by_class_index(argv[1], index,
> +							  argv[3]);
> +		else
> +			return CMD_RET_USAGE;
> +	}
> +
> +	if (ret)

FWIW, gcc 7.3.0 complains at this line:

cmd/bind.c: In function ‘do_bind_unbind’:
cmd/bind.c:236:5: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (ret)
     ^

> +		return CMD_RET_FAILURE;
> +	else
> +		return CMD_RET_SUCCESS;
> +}

Best regards,
Eugeniu.

  parent reply	other threads:[~2018-07-11 20:59 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22 12:25 [U-Boot] [PATCH v3 0/7] Fixes/Addition to use the USB Ethernet gadget with the DWC3 gadget controller Jean-Jacques Hiblot
2018-06-22 12:25 ` [U-Boot] [PATCH v3 1/7] usb: gadget: Add bcdDevice for the DWC3 USB Gadget Controller Jean-Jacques Hiblot
2018-06-22 12:25 ` [U-Boot] [PATCH v3 2/7] net: eth-uclass: Fix for DM USB ethernet support Jean-Jacques Hiblot
2018-06-22 12:25 ` [U-Boot] [PATCH v3 3/7] uclass: Add dev_get_uclass_index() to get the uclass/index of a device Jean-Jacques Hiblot
2018-06-30  4:19   ` Simon Glass
2018-07-04 13:10     ` Jean-Jacques Hiblot
2018-06-22 12:25 ` [U-Boot] [PATCH v3 4/7] dm: print the index of the device when dumping the dm tree Jean-Jacques Hiblot
2018-06-22 12:25 ` [U-Boot] [PATCH v3 5/7] dm: convert device_get_global_by_of_offset() to device_get_global_by_ofnode() Jean-Jacques Hiblot
2018-06-30  4:19   ` Simon Glass
2018-06-22 12:25 ` [U-Boot] [PATCH v3 6/7] device: expose the functions used to remove and unbind children of a device Jean-Jacques Hiblot
2018-06-30  4:19   ` Simon Glass
2018-06-22 12:25 ` [U-Boot] [PATCH v3 7/7] cmd: Add bind/unbind commands to bind a device to a driver from the command line Jean-Jacques Hiblot
2018-06-27 14:13   ` Michal Simek
2018-06-30  4:19     ` Simon Glass
2018-07-09  6:19       ` Michal Simek
2018-07-09 14:43         ` Tom Rini
2018-07-09 16:59           ` Joe Hershberger
2018-07-10 16:40             ` Tom Rini
2018-07-11  5:57               ` Michal Simek
2018-07-11 12:46                 ` Tom Rini
2018-07-11 13:31                   ` Michal Simek
2018-07-11 13:40                     ` Tom Rini
2018-07-11 20:13                       ` Simon Glass
2018-07-16  8:33                         ` Michal Simek
2018-07-17  3:44                           ` Simon Glass
2018-07-20 12:05                             ` Michal Simek
2018-07-11 13:57   ` Jagan Teki
2018-07-11 20:59   ` Eugeniu Rosca [this message]
2018-08-08  6:35 ` [U-Boot] [PATCH v3 0/7] Fixes/Addition to use the USB Ethernet gadget with the DWC3 gadget controller Michal Simek
2018-08-08  9:17   ` Eugeniu Rosca
2018-08-08  9:58     ` Michal Simek
2018-08-08 10:26       ` Eugeniu Rosca
2018-08-08 11:36     ` Jean-Jacques Hiblot
2018-08-08 13:08       ` Eugeniu Rosca
2018-08-08 16:17         ` Jean-Jacques Hiblot
2018-08-08 16:44           ` Eugeniu Rosca
2018-08-08 16:54             ` Tom Rini
2018-08-08 18:29               ` Eugeniu Rosca
2018-08-09 14:21               ` Jean-Jacques Hiblot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180711205951.GA25014@x230 \
    --to=roscaeugeniu@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox