1. 27 2月, 2014 6 次提交
  2. 26 2月, 2014 1 次提交
    • J
      bnx2x: Remove hidden flow control goto from BNX2X_ALLOC macros · cd2b0389
      Joe Perches 提交于
      BNX2X_ALLOC macros use "goto alloc_mem_err"
      so these labels appear unused in some functions.
      
      Expand these macros in-place via coccinelle and
      some typing.
      
      Update the macros to use statement expressions
      and remove the BNX2X_ALLOC macro.
      
      This adds some > 80 char lines.
      
      $ cat bnx2x_pci_alloc.cocci
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	BNX2X_PCI_ALLOC(e1, e2, e3);
      +	e1 = BNX2X_PCI_ALLOC(e2, e3); if (!e1) goto alloc_mem_err;
      
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	BNX2X_PCI_FALLOC(e1, e2, e3);
      +	e1 = BNX2X_PCI_FALLOC(e2, e3); if (!e1) goto alloc_mem_err;
      
      @@
      expression e1;
      expression e2;
      @@
      -	BNX2X_ALLOC(e1, e2);
      +	e1 = kzalloc(e2, GFP_KERNEL); if (!e1) goto alloc_mem_err;
      
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	kzalloc(sizeof(e1) * e2, e3)
      +	kcalloc(e2, sizeof(e1), e3)
      
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	kzalloc(e1 * sizeof(e2), e3)
      +	kcalloc(e1, sizeof(e2), e3)
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cd2b0389
  3. 25 2月, 2014 33 次提交