From patchwork Wed Jul 8 12:26:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 6746681 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8A5E6C05AC for ; Wed, 8 Jul 2015 12:32:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B892820691 for ; Wed, 8 Jul 2015 12:32:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1908020639 for ; Wed, 8 Jul 2015 12:32:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCoUY-0000or-Th; Wed, 08 Jul 2015 12:30:22 +0000 Received: from mail-pa0-f48.google.com ([209.85.220.48]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCoUH-0007kK-Ng for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2015 12:30:06 +0000 Received: by pacws9 with SMTP id ws9so132578577pac.0 for ; Wed, 08 Jul 2015 05:29:45 -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:in-reply-to :references; bh=rI3j99MG048/U9X+Ytm6htttTAeZDCbxz8taBtk6RD4=; b=NXfwV3Qgka0fm70MMNzOSDlrbvpKr/2LRIhmlHnVRoRtQRElp1GpHhz/i4pgOM7zDM 1qsi5VM8uaIlsX1sGgMse+tav5+psiuq5OF9oAkd7gwf173ZiSGxDl9FKdKNLZA/UHbo oIYN2As76v+yKnlw5xPhIfJ/gpiAPbASpUpRk3oquj5y6uXhRx30soJ0vte6ENrvu8nj RAQhFKOrqt8jpcEffysk265rnNdEyuH8qJ2vpBWSJRRccxXTbTn8FQmbGbtb8aH/nab1 owNvYSLGLRVZX+oBZx//DHWNL1LSJZR1e9kB2qNgSoWRak+l43IEdwqP4aYLxkvWKG/W O1IQ== X-Gm-Message-State: ALoCoQmacdMasitmNNUM2WtIjWX5pOIiI5hyCDcfp3Dy5qiu+0jbKtsQ2NYlNMIejt1XcWIk7RrJ X-Received: by 10.66.151.133 with SMTP id uq5mr19998703pab.7.1436358585148; Wed, 08 Jul 2015 05:29:45 -0700 (PDT) Received: from localhost.localdomain ([202.62.93.138]) by smtp.gmail.com with ESMTPSA id db1sm2415741pdb.50.2015.07.08.05.29.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jul 2015 05:29:44 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Subject: [PATCH-v6 4/6] mfd: 88pm800: Remove unnecessary protection around pdata Date: Wed, 8 Jul 2015 17:56:30 +0530 Message-Id: <1436358392-15449-5-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436358392-15449-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1436358392-15449-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150708_053005_843159_F51428D0 X-CRM114-Status: GOOD ( 14.40 ) X-Spam-Score: 0.7 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: open list , Lee Jones , Vaibhav Hiremath , Samuel Ortiz MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SBL_CSS, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no 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 With addition of proper checks in place in pm800_probe function, which makes sure that pdata would never become NULL. So remove all unnecessary protection around pdata in whole driver code. Signed-off-by: Vaibhav Hiremath Reviewed-by: Krzysztof Kozlowski Acked-by: Lee Jones --- drivers/mfd/88pm800.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index af8232f..074ba8b 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -302,7 +302,7 @@ static int device_gpadc_init(struct pm80x_chip *chip) mask = (PM800_GPADC_GP_BIAS_EN0 | PM800_GPADC_GP_BIAS_EN1 | PM800_GPADC_GP_BIAS_EN2 | PM800_GPADC_GP_BIAS_EN3); - if (pdata && (pdata->batt_det == 0)) + if (pdata->batt_det == 0) data = (PM800_GPADC_GP_BIAS_EN0 | PM800_GPADC_GP_BIAS_EN1 | PM800_GPADC_GP_BIAS_EN2 | PM800_GPADC_GP_BIAS_EN3); else @@ -331,11 +331,8 @@ static int device_rtc_init(struct pm80x_chip *chip) { struct pm80x_platform_data *pdata = dev_get_platdata(chip->dev); - if (pdata) { - rtc_devs[0].platform_data = pdata->rtc; - rtc_devs[0].pdata_size = - pdata->rtc ? sizeof(struct pm80x_rtc_pdata) : 0; - } + rtc_devs[0].platform_data = pdata->rtc; + rtc_devs[0].pdata_size = pdata->rtc ? sizeof(struct pm80x_rtc_pdata) : 0; return mfd_add_devices(chip->dev, 0, &rtc_devs[0], ARRAY_SIZE(rtc_devs), NULL, 0, NULL); @@ -478,7 +475,7 @@ static int device_800_init(struct pm80x_chip *chip) goto out; } if (val & PM800_ALARM_WAKEUP) { - if (pdata && pdata->rtc) + if (pdata->rtc) pdata->rtc->rtc_wakeup = 1; } @@ -580,7 +577,7 @@ static int pm800_probe(struct i2c_client *client, goto err_device_init; } - if (pdata && pdata->plat_config) + if (pdata->plat_config) pdata->plat_config(chip, pdata); return 0;