From patchwork Mon Jul 7 20:01:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 4497111 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 31B649F1C4 for ; Mon, 7 Jul 2014 20:00:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6ADA1202B8 for ; Mon, 7 Jul 2014 20:00:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 977ED202E6 for ; Mon, 7 Jul 2014 20:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751373AbaGGUAp (ORCPT ); Mon, 7 Jul 2014 16:00:45 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:57191 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751798AbaGGT7z (ORCPT ); Mon, 7 Jul 2014 15:59:55 -0400 Received: by mail-wg0-f48.google.com with SMTP id x12so22653wgg.19 for ; Mon, 07 Jul 2014 12:59:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XWnBjvuNShaPEi+YH6udwuGdEnQojS5sMrtfGANwGyY=; b=AqSBKu5oJfVOZI7oBKvcVOesEKYCQoUMg+hH1QoyAnpN0HJUYybLvo8fjv8YLH/hRU RQYDOflZs1cWj/L24DYv7Ba0QY2pdxEEJhfc80jmjo9XvFtnwNuUjx3y3/qMHYRKmmxV nCLhnkYd53661LaLZLI7YPfiev5+GiOPcMIsMCryCC0NHnPs7dcTiF3auJpoVx3yvSbd TDEhllpjiKaflg51Tb1bbinIoHKgXHBOHjrgnWYLlpccLiqhCMckP1O/BOq3So+gpUQN cBLyerKYR5JzzKTKD2G3am7EyV6CzLVNDy5ybwNp35hiAg44/B5XSECHst06DkOjT7sq 0nzg== X-Gm-Message-State: ALoCoQlFAtgK3TmRF0DRfX/i2dADiEw9UAXduQI0+s6Tex8FOhxouMnYeBTQ/IFr4IbeIRvOFRqW X-Received: by 10.180.9.202 with SMTP id c10mr32888953wib.13.1404763194153; Mon, 07 Jul 2014 12:59:54 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id fb8sm118641794wib.15.2014.07.07.12.59.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Jul 2014 12:59:53 -0700 (PDT) From: Rickard Strandqvist To: Jingoo Han , Bryan Wu Cc: Rickard Strandqvist , Lee Jones , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] video: backlight: jornada720_lcd.c: Cleaning up variable that is never used Date: Mon, 7 Jul 2014 22:01:10 +0200 Message-Id: <1404763270-24932-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Variable ar assigned a value that is never used. I have also removed all the code that thereby serves no purpose, and made same change to clarify the similarities in function. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist Reviewed-by: Rickard Strandqvist Signed-off-by: Lee Jones Acked-by: Jingoo Han --- drivers/video/backlight/jornada720_lcd.c | 31 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/video/backlight/jornada720_lcd.c b/drivers/video/backlight/jornada720_lcd.c index da3876c..d16abcf 100644 --- a/drivers/video/backlight/jornada720_lcd.c +++ b/drivers/video/backlight/jornada720_lcd.c @@ -36,44 +36,41 @@ static int jornada_lcd_get_power(struct lcd_device *ld) static int jornada_lcd_get_contrast(struct lcd_device *ld) { - int ret; + int ret = -ETIMEDOUT; if (jornada_lcd_get_power(ld) != FB_BLANK_UNBLANK) return 0; jornada_ssp_start(); - if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) { + if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) dev_err(&ld->dev, "get contrast failed\n"); - jornada_ssp_end(); - return -ETIMEDOUT; - } else { + else ret = jornada_ssp_byte(TXDUMMY); - jornada_ssp_end(); - return ret; - } + + jornada_ssp_end(); + + return ret; } static int jornada_lcd_set_contrast(struct lcd_device *ld, int value) { - int ret; + int ret = -ETIMEDOUT; jornada_ssp_start(); /* start by sending our set contrast cmd to mcu */ - ret = jornada_ssp_byte(SETCONTRAST); - + if (jornada_ssp_byte(SETCONTRAST) != TXDUMMY) + dev_err(&ld->dev, "set contrast failed\n"); /* push the new value */ - if (jornada_ssp_byte(value) != TXDUMMY) { + else if (jornada_ssp_byte(value) != TXDUMMY) dev_err(&ld->dev, "set contrast failed\n"); - jornada_ssp_end(); - return -ETIMEDOUT; - } + else /* if we get here we can assume everything went well */ + ret = 0; - /* if we get here we can assume everything went well */ jornada_ssp_end(); - return 0; + return ret; } static int jornada_lcd_set_power(struct lcd_device *ld, int power)