From patchwork Mon Jun 29 15:31:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 6689801 Return-Path: X-Original-To: patchwork-linux-arm@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 DDF869F46A for ; Mon, 29 Jun 2015 15:40:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0826B2045B for ; Mon, 29 Jun 2015 15:40:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FBF1202E6 for ; Mon, 29 Jun 2015 15:40:42 +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 1Z9b7L-00033P-Qo; Mon, 29 Jun 2015 15:37:07 +0000 Received: from mail-pd0-f178.google.com ([209.85.192.178]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z9b6r-0002Ur-Dl for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2015 15:36:38 +0000 Received: by pdcu2 with SMTP id u2so118737817pdc.3 for ; Mon, 29 Jun 2015 08:36:16 -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=7inHU0y0tO9gEoHLZdvZuWDowk7Iuf6AFKAOTR/ALGM=; b=HYbOW+dmu/Yby+j/18IuBkoydFUu6vfztdw75jFwd4kH8iqHsL6drBeF+2qU8VGN6e e+I+ky7fWtIOFkxgjhz8imbqcL3IJrIzPv3z5ykMYSih+xezKrQAY09g+Nrv5LHdg0Pz 9ROxfwHadvJvQWM3BtRCfeu/ZINBgLx8zhSBzjaOG2yTUBSr1jo7kcB58AkpHWMvMTi+ YNHVnDp91ePc0W5V2ZivwjJ2Hni2u2LV3Ruu7NnxfimNIVQKTz4lR+bFbd+0ryFEIeDD zAh/aFm5Irn0xYn8A4tapir74vQrA5a+FKgqj2vXH3QOml+EPNNjhl2KdmDemaoYDpc+ UEEA== X-Gm-Message-State: ALoCoQnt9ealowW4pE3/TlxptMY0AvdytQ8XF6iwc7iRlk6wqTPIObgYNobN4Zq0viICQvvVB0Bb X-Received: by 10.68.224.35 with SMTP id qz3mr32969120pbc.165.1435592176084; Mon, 29 Jun 2015 08:36:16 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id fq2sm2772621pdb.35.2015.06.29.08.36.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Jun 2015 08:36:15 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Subject: [PATCH-V5 2/4] mfd: 88pm800: Remove unnecessary protection around pdata Date: Mon, 29 Jun 2015 21:01:15 +0530 Message-Id: <1435591877-18214-3-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435591877-18214-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1435591877-18214-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150629_083637_526537_891B67DA X-CRM114-Status: GOOD ( 14.42 ) X-Spam-Score: -2.6 (--) Cc: devicetree@vger.kernel.org, sameo@linux.intel.com, yizhang@marvell.com, linux-kernel@vger.kernel.org, Vaibhav Hiremath , robh+dt@kernel.org, lee.jones@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 40fd014..d495737 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 @@ -342,11 +342,9 @@ static int device_rtc_init(struct pm80x_chip *chip, { int ret; - 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; + ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], ARRAY_SIZE(rtc_devs), NULL, 0, NULL); if (ret) { @@ -503,7 +501,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; } @@ -602,7 +600,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;