From patchwork Tue Sep 18 12:07:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Senna Tschudin X-Patchwork-Id: 1472371 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9110CDF24C for ; Tue, 18 Sep 2012 12:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932857Ab2IRMIt (ORCPT ); Tue, 18 Sep 2012 08:08:49 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:60032 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932802Ab2IRMIQ (ORCPT ); Tue, 18 Sep 2012 08:08:16 -0400 Received: by mail-wg0-f44.google.com with SMTP id dr13so6782424wgb.1 for ; Tue, 18 Sep 2012 05:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=te4tOhkEFHT5Bs5E9+lRrSu7onT5p6SG9Bw9XtV9wHA=; b=wLOEA4QfHVbDEAoGrkYtiHslbJrOQTe/QjCq4wWDixYdF7IY9KeAlUH32xpBD5FuvF UqcQ9rdYkSSyC8owFfPpkZ9pfMepOdwy7thQ45YMMIwydVNc48wLjQfNuuvCOUA2e90Z g3w3kT+JHvdijY9vF5qkD+keQ4kOQ/xeLExRqlnOE45cGWtNA+z5ZgOszhoZ5Yfqe3YH pUDqn4nx4j7M2kvDY3I/1Wl7oa2pF/IVa2ICaoMQnBS71roiWiT8iDuN6/+tCPzSQxOv EBmELj/gXm9ydZyhWGlQpjkSGsN17TSJTZHnvrMwXM2SRLcWQABr/RYZs43T/Lu7vPAL DhQA== Received: by 10.180.90.104 with SMTP id bv8mr22881216wib.22.1347970095961; Tue, 18 Sep 2012 05:08:15 -0700 (PDT) Received: from ace.home.fr (ppeter.rsr.lip6.fr. [132.227.76.16]) by mx.google.com with ESMTPS id eu4sm22494251wib.2.2012.09.18.05.08.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Sep 2012 05:08:15 -0700 (PDT) From: Peter Senna Tschudin To: geoff@infradead.org Cc: FlorianSchandinat@gmx.de, linuxppc-dev@lists.ozlabs.org, cbe-oss-dev@lists.ozlabs.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Peter Senna Tschudin Subject: [PATCH 09/10] drivers/video/ps3fb.c: fix error return code Date: Tue, 18 Sep 2012 14:07:59 +0200 Message-Id: <1347970080-25175-9-git-send-email-peter.senna@gmail.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1347970080-25175-1-git-send-email-peter.senna@gmail.com> References: <1347970080-25175-1-git-send-email-peter.senna@gmail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: Peter Senna Tschudin 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/) // ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Peter Senna Tschudin --- 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 */