From patchwork Thu Mar 26 22:27:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel von Czettritz X-Patchwork-Id: 6102381 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5D6F69F2A9 for ; Thu, 26 Mar 2015 22:27:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6208620434 for ; Thu, 26 Mar 2015 22:27:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80A8220412 for ; Thu, 26 Mar 2015 22:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932115AbbCZW1a (ORCPT ); Thu, 26 Mar 2015 18:27:30 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:34010 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932094AbbCZW13 (ORCPT ); Thu, 26 Mar 2015 18:27:29 -0400 Received: by wgs2 with SMTP id 2so80472912wgs.1; Thu, 26 Mar 2015 15:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=gHHKJ+vGKZiL2bgGo3lshN3Q/rcLN1oDXyTJxJOgF6w=; b=lQXAto+s5sYNkMa2SGWOqH5lvBqfkaxv5buwzNJaNJYwNhslpVwy6c46GDfG5hvsJa WSfooJS1cdnqPNtCQNdUvRRE2xhXjPyE2fkShcQpUZjKN8F1dgLWUAyf2jV8thTLZgux ULf/0+5HCw4Tj5judq2P601uZe9/G/s6+h3g62QOqr+iWcehiVz4iCxgEpgrpossYSUm xaZJhTq04fWlDwaMm9/CzIcAdJNvlJFZqwiS/8VTB9q3TbHCiqnrYjjoWNWUV4r/WcDV l5abbx7JJPZGgqDcw2quCJlKkdtnxADNeb0vnOUBj4SNSDLOPT6MahOaN8wCRLPljqxj wlBg== X-Received: by 10.180.208.107 with SMTP id md11mr52319478wic.10.1427408848188; Thu, 26 Mar 2015 15:27:28 -0700 (PDT) Received: from x230-arch (port-92-203-54-78.dynamic.qsc.de. [92.203.54.78]) by mx.google.com with ESMTPSA id fo9sm782799wib.16.2015.03.26.15.27.26 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Mar 2015 15:27:27 -0700 (PDT) Date: Thu, 26 Mar 2015 23:27:25 +0100 From: Michel von Czettritz To: sudipm.mukherjee@gmail.com Cc: teddy.wang@siliconmotion.com, kernel-janitors@vger.kernel.org, gregkh@linuxfoundation.org, linux-fbdev@vger.kernel.org Subject: [PATCH v2 12/12] staging: sm750: move assignment out of if cond Message-ID: <1d869c193fc53160e5a2ef06bbb2b7ce9786bd2e.1427406762.git.michel.von.czettritz@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch moves the assignments from the if conditions to the line before the condition. The 3 occurrence are return values and the checks for errors. Signed-off-by: Michel von Czettritz --- v2: remove double negation in if statments --- drivers/staging/sm750fb/sm750.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index d363f55..25df813 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -477,7 +477,8 @@ static int lynxfb_resume(struct pci_dev *pdev) console_lock(); - if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0) { + ret = pci_set_power_state(pdev, PCI_D0); + if (ret) { pr_err("error:%d occured in pci_set_power_state\n", ret); return ret; } @@ -485,7 +486,8 @@ static int lynxfb_resume(struct pci_dev *pdev) if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { pci_restore_state(pdev); - if ((ret = pci_enable_device(pdev)) != 0) { + ret = pci_enable_device(pdev); + if (ret) { pr_err("error:%d occured in pci_enable_device\n", ret); return ret; } @@ -975,7 +977,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); - if ((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) { + ret = fb_alloc_cmap(&info->cmap, 256, 0); + if (ret < 0) { pr_err("Could not allcate memory for cmap.\n"); goto exit; }