linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <peter.senna@gmail.com>
To: geoff@infradead.org
Cc: cbe-oss-dev@lists.ozlabs.org, linux-fbdev@vger.kernel.org,
	FlorianSchandinat@gmx.de,
	Peter Senna Tschudin <peter.senna@gmail.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 09/10] drivers/video/ps3fb.c: fix error return code
Date: Tue, 18 Sep 2012 12:07:59 +0000	[thread overview]
Message-ID: <1347970080-25175-9-git-send-email-peter.senna@gmail.com> (raw)
In-Reply-To: <1347970080-25175-1-git-send-email-peter.senna@gmail.com>

From: Peter Senna Tschudin <peter.senna@gmail.com>

Convert a nonnegative error return code to a negative one, as returned
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: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/video/ps3fb.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 4e292f2..0b340d6 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1034,6 +1034,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
 	if (status) {
 		dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n",
 			__func__, status);
+		retval = -ENOMEM;
 		goto err_close_device;
 	}
 	dev_dbg(&dev->core, "ddr:lpar:0x%llx\n", ddr_lpar);
@@ -1046,6 +1047,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
 		dev_err(&dev->core,
 			"%s: lv1_gpu_context_allocate failed: %d\n", __func__,
 			status);
+		retval = -ENOMEM;
 		goto err_gpu_memory_free;
 	}
 
@@ -1053,6 +1055,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
 	dinfo = (void __force *)ioremap(lpar_driver_info, 128 * 1024);
 	if (!dinfo) {
 		dev_err(&dev->core, "%s: ioremap failed\n", __func__);
+		retval = -ENOMEM;
 		goto err_gpu_context_free;
 	}
 
@@ -1121,8 +1124,10 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
 	}
 
 	info = framebuffer_alloc(sizeof(struct ps3fb_par), &dev->core);
-	if (!info)
+	if (!info) {
+		retval = -ENOMEM;
 		goto err_context_fb_close;
+	}
 
 	par = info->par;
 	par->mode_id = ~ps3fb_mode;	/* != ps3fb_mode, to trigger change */
-- 
1.7.11.4


  parent reply	other threads:[~2012-09-18 12:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 12:07 [PATCH 01/10] drivers/video/mb862xx/mb862xxfbdrv.c: fix error return code Peter Senna Tschudin
2012-09-18 12:07 ` [PATCH 02/10] drivers/video/sunxvr1000.c: " Peter Senna Tschudin
2012-09-18 12:07 ` [PATCH 03/10] drivers/video/cg3.c: " Peter Senna Tschudin
2012-09-18 12:07 ` [PATCH 04/10] drivers/video/sunxvr500.c: " Peter Senna Tschudin
2012-09-18 12:07 ` [PATCH 05/10] drivers/video/atmel_lcdfb.c: " Peter Senna Tschudin
2012-09-18 12:07 ` [PATCH 06/10] drivers/video/imxfb.c: " Peter Senna Tschudin
2012-09-18 12:07 ` [PATCH 07/10] drivers/video/bw2.c: " Peter Senna Tschudin
2012-09-18 12:07 ` [PATCH 08/10] drivers/video/cyber2000fb.c: " Peter Senna Tschudin
2012-09-18 12:07 ` Peter Senna Tschudin [this message]
2012-09-18 12:08 ` [PATCH 10/10] drivers/video/arcfb.c: " Peter Senna Tschudin
2012-09-23 19:52 ` [PATCH 01/10] drivers/video/mb862xx/mb862xxfbdrv.c: " Florian Tobias Schandinat

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=1347970080-25175-9-git-send-email-peter.senna@gmail.com \
    --to=peter.senna@gmail.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=cbe-oss-dev@lists.ozlabs.org \
    --cc=geoff@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).