All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard.weinberger@gmail.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
	kernel-janitors@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/25] UBI: fix error return code
Date: Tue, 31 Dec 2013 12:30:39 +0100	[thread overview]
Message-ID: <CAFLxGvx+JrErEM1z=_86DVcGeufFR2jgLhNMYoUJ5i2dZLYmxQ@mail.gmail.com> (raw)
In-Reply-To: <1388357260-4843-5-git-send-email-Julia.Lawall@lip6.fr>

On Sun, Dec 29, 2013 at 11:47 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Set the return variable to an error code as done elsewhere in the function.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
>
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Reviewed-by: Richard Weinberger <richard@nod.at>

> ---
> Not tested.
>
>  drivers/mtd/ubi/attach.c |    4 +++-
>  drivers/mtd/ubi/build.c  |    4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
> index 33bb1f2..6f27d9a 100644
> --- a/drivers/mtd/ubi/attach.c
> +++ b/drivers/mtd/ubi/attach.c
> @@ -1453,8 +1453,10 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
>                 struct ubi_attach_info *scan_ai;
>
>                 scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache");
> -               if (!scan_ai)
> +               if (!scan_ai) {
> +                       err = -ENOMEM;
>                         goto out_wl;
> +               }
>
>                 err = scan_all(ubi, scan_ai, 0);
>                 if (err) {
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index e05dc62..57deae9 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -1245,8 +1245,10 @@ static int __init ubi_init(void)
>         ubi_wl_entry_slab = kmem_cache_create("ubi_wl_entry_slab",
>                                               sizeof(struct ubi_wl_entry),
>                                               0, 0, NULL);
> -       if (!ubi_wl_entry_slab)
> +       if (!ubi_wl_entry_slab) {
> +               err = -ENOMEM;
>                 goto out_dev_unreg;
> +       }
>
>         err = ubi_debugfs_init();
>         if (err)
>
> --
> 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/



-- 
Thanks,
//richard

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard.weinberger@gmail.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
	kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 4/25] UBI: fix error return code
Date: Tue, 31 Dec 2013 11:30:39 +0000	[thread overview]
Message-ID: <CAFLxGvx+JrErEM1z=_86DVcGeufFR2jgLhNMYoUJ5i2dZLYmxQ@mail.gmail.com> (raw)
In-Reply-To: <1388357260-4843-5-git-send-email-Julia.Lawall@lip6.fr>

On Sun, Dec 29, 2013 at 11:47 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Set the return variable to an error code as done elsewhere in the function.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
>
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Reviewed-by: Richard Weinberger <richard@nod.at>

> ---
> Not tested.
>
>  drivers/mtd/ubi/attach.c |    4 +++-
>  drivers/mtd/ubi/build.c  |    4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
> index 33bb1f2..6f27d9a 100644
> --- a/drivers/mtd/ubi/attach.c
> +++ b/drivers/mtd/ubi/attach.c
> @@ -1453,8 +1453,10 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
>                 struct ubi_attach_info *scan_ai;
>
>                 scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache");
> -               if (!scan_ai)
> +               if (!scan_ai) {
> +                       err = -ENOMEM;
>                         goto out_wl;
> +               }
>
>                 err = scan_all(ubi, scan_ai, 0);
>                 if (err) {
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index e05dc62..57deae9 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -1245,8 +1245,10 @@ static int __init ubi_init(void)
>         ubi_wl_entry_slab = kmem_cache_create("ubi_wl_entry_slab",
>                                               sizeof(struct ubi_wl_entry),
>                                               0, 0, NULL);
> -       if (!ubi_wl_entry_slab)
> +       if (!ubi_wl_entry_slab) {
> +               err = -ENOMEM;
>                 goto out_dev_unreg;
> +       }
>
>         err = ubi_debugfs_init();
>         if (err)
>
> --
> 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/



-- 
Thanks,
//richard

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard.weinberger@gmail.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
	kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 4/25] UBI: fix error return code
Date: Tue, 31 Dec 2013 12:30:39 +0100	[thread overview]
Message-ID: <CAFLxGvx+JrErEM1z=_86DVcGeufFR2jgLhNMYoUJ5i2dZLYmxQ@mail.gmail.com> (raw)
In-Reply-To: <1388357260-4843-5-git-send-email-Julia.Lawall@lip6.fr>

On Sun, Dec 29, 2013 at 11:47 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Set the return variable to an error code as done elsewhere in the function.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
>
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Reviewed-by: Richard Weinberger <richard@nod.at>

> ---
> Not tested.
>
>  drivers/mtd/ubi/attach.c |    4 +++-
>  drivers/mtd/ubi/build.c  |    4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
> index 33bb1f2..6f27d9a 100644
> --- a/drivers/mtd/ubi/attach.c
> +++ b/drivers/mtd/ubi/attach.c
> @@ -1453,8 +1453,10 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
>                 struct ubi_attach_info *scan_ai;
>
>                 scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache");
> -               if (!scan_ai)
> +               if (!scan_ai) {
> +                       err = -ENOMEM;
>                         goto out_wl;
> +               }
>
>                 err = scan_all(ubi, scan_ai, 0);
>                 if (err) {
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index e05dc62..57deae9 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -1245,8 +1245,10 @@ static int __init ubi_init(void)
>         ubi_wl_entry_slab = kmem_cache_create("ubi_wl_entry_slab",
>                                               sizeof(struct ubi_wl_entry),
>                                               0, 0, NULL);
> -       if (!ubi_wl_entry_slab)
> +       if (!ubi_wl_entry_slab) {
> +               err = -ENOMEM;
>                 goto out_dev_unreg;
> +       }
>
>         err = ubi_debugfs_init();
>         if (err)
>
> --
> 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/



-- 
Thanks,
//richard

  reply	other threads:[~2013-12-31 11:30 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-29 21:58 [PATCH 0/25] fix error return code Julia Lawall
2013-12-29 22:47 ` Julia Lawall
2013-12-29 22:47 ` Julia Lawall
2013-12-29 22:47 ` Julia Lawall
2013-12-29 22:47 ` Julia Lawall
2013-12-29 22:47 ` Julia Lawall
2013-12-29 21:52 ` [PATCH 23/25] thermal: exynos: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-30  1:31   ` Jingoo Han
2013-12-30  1:31     ` Jingoo Han
2013-12-30  1:31     ` Jingoo Han
2014-01-02  1:55   ` Zhang Rui
2014-01-02  1:55     ` Zhang Rui
2014-01-02  1:55     ` Zhang Rui
2013-12-29 21:53 ` [PATCH 21/25] fujitsu-laptop: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-31 13:05   ` Jonathan Woithe
2013-12-31 13:17     ` Jonathan Woithe
2013-12-29 21:53 ` [PATCH 20/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:53 ` [PATCH 15/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:54 ` [PATCH 13/25] hamradio: 6pack: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2014-01-02  8:31   ` David Miller
2014-01-02  8:31     ` David Miller
2013-12-29 21:54 ` [PATCH 24/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:54 ` [PATCH 22/25] RDMA/nes: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:54 ` [PATCH 14/25] RDMA/amso1100: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:54 ` [PATCH 9/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:55 ` [PATCH 19/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:58   ` Geert Uytterhoeven
2013-12-29 21:58     ` Geert Uytterhoeven
2013-12-29 21:58     ` Geert Uytterhoeven
2013-12-29 21:55 ` [PATCH 11/25] pcmcia: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:55 ` [PATCH 12/25] HID: sony: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2014-01-02 12:51   ` Jiri Kosina
2014-01-02 12:51     ` Jiri Kosina
2013-12-29 21:56 ` [PATCH 10/25] usb: gadget: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:56 ` [PATCH 18/25] mtd: nand: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:56 ` [PATCH 16/25] block: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:57 ` [PATCH 17/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:57 ` [PATCH 6/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2014-01-03  9:08   ` Jiri Kosina
2014-01-03  9:08     ` Jiri Kosina
2013-12-29 21:57 ` [PATCH 8/25] drivers/dma: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2014-01-20  9:28   ` Vinod Koul
2014-01-20  9:40     ` Vinod Koul
2013-12-29 21:59 ` [PATCH 7/25] net: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2014-01-02  8:31   ` David Miller
2014-01-02  8:31     ` David Miller
2013-12-29 21:59 ` [PATCH 5/25] IB/mlx4: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
     [not found]   ` <1388357260-4843-6-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2013-12-31  7:52     ` Jack Morgenstein
2013-12-31  7:52       ` Jack Morgenstein
2013-12-31  7:52       ` Jack Morgenstein
2013-12-29 21:59 ` [PATCH 3/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 21:59 ` [PATCH 4/25] UBI: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-31 11:30   ` Richard Weinberger [this message]
2013-12-31 11:30     ` Richard Weinberger
2013-12-31 11:30     ` Richard Weinberger
2014-01-02 15:16   ` Artem Bityutskiy
2014-01-02 15:16     ` Artem Bityutskiy
2014-01-02 15:16     ` Artem Bityutskiy
2013-12-29 22:00 ` [PATCH 2/25] rsxx: " Julia Lawall
2013-12-29 22:47   ` Julia Lawall
2013-12-29 22:00 ` [PATCH 1/25] " Julia Lawall
2013-12-29 22:47   ` Julia Lawall

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='CAFLxGvx+JrErEM1z=_86DVcGeufFR2jgLhNMYoUJ5i2dZLYmxQ@mail.gmail.com' \
    --to=richard.weinberger@gmail.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.