Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1208484

Re: [PATCH 1/3] staging: wilc1000: code style: fix macro with multiple statements

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] staging: wilc1000: code style: fix macro with multiple statements
Date 2015-08-17 11:10 +0200
Message-ID <pYoAy-2Ok-5@gated-at.bofh.it> (permalink)
References <pXYPL-7Bh-3@gated-at.bofh.it> <pXYPL-7Bh-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Aug 16, 2015 at 01:30:12AM -0400, Raphaël Beamonte wrote:
>  #define MALLOC_WILC_BUFFER(name, size)	\
> -	exported_ ## name = kmalloc(size, GFP_KERNEL);	  \
> -	if (!exported_ ## name) {   \
> -		printk("fail to alloc: %s memory\n", exported_ ## name);  \
> -		return -ENOBUFS;	\
> -	}
> +	do { \
> +		exported_ ## name = kmalloc(size, GFP_KERNEL);	  \
> +		if (!exported_ ## name) {   \
> +			printk("fail to alloc: %s memory\n", exported_ ## name);  \
> +			return -ENOBUFS;	\
> +		}
> +	} while (0)

Pull it in one indent level...  But actually this macro has a return in
the middle of it, so it just introduces bugs all over the place like
eating cookies in bed.  We should just delete it instead.

regards,
dan carpenter

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] staging: wilc1000: code style: fix macro with multiple statements Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-16 07:40 +0200
  Re: [PATCH 1/3] staging: wilc1000: code style: fix macro with  multiple statements Dan Carpenter <dan.carpenter@oracle.com> - 2015-08-17 11:10 +0200
    Re: [PATCH 1/3] staging: wilc1000: code style: fix macro with  multiple statements Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-17 16:50 +0200
      [PATCH 0/5] staging: wilc1000: code improvements Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-17 18:10 +0200
        [PATCH 5/5] staging: wilc1000: remove void function return statements that are not useful Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-17 18:10 +0200
        [PATCH 2/5] staging: wilc1000: remove FREE_WILC_BUFFER() Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-17 18:20 +0200
          Re: [PATCH 2/5] staging: wilc1000: remove FREE_WILC_BUFFER() Dan Carpenter <dan.carpenter@oracle.com> - 2015-08-17 19:50 +0200
        [PATCHv2 0/5] staging: wilc1000: code improvements Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-17 21:30 +0200
          [PATCHv2 1/5] staging: wilc1000: remove void function return statements that are not useful Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-17 21:30 +0200
          [PATCHv2 3/5] staging: wilc1000: remove DECLARE_WILC_BUFFER() Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-08-17 21:40 +0200

csiph-web