From patchwork Tue Sep 5 07:41:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 9938081 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84B6B601EB for ; Tue, 5 Sep 2017 07:41:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75976288B7 for ; Tue, 5 Sep 2017 07:41:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A733288CD; Tue, 5 Sep 2017 07:41:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07F7A288B7 for ; Tue, 5 Sep 2017 07:41:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751380AbdIEHlX (ORCPT ); Tue, 5 Sep 2017 03:41:23 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34109 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750775AbdIEHlW (ORCPT ); Tue, 5 Sep 2017 03:41:22 -0400 Received: by mail-pf0-f195.google.com with SMTP id y68so1325848pfd.1; Tue, 05 Sep 2017 00:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0EmvdC7zUHDxE/5ghIc63e3wsGY/KRQ1uaVrsQ4TXdQ=; b=ryffmEDcDOI5klQBr2I0XamzI7tnsyZXdhzNUzZZf6MDOWpKz+tlkwfSVP1V1YCb/K Qm21uO7nuGq3b12aOYxF0eeoGtAqPFrO5pCDGuyaowC9M95w7zFLlyvZs4qAy106Jx5n XSpNwIGUmjoxl2gok7IolkztRwDtxXwnBM3pIft0juMcNfqFzz89vzWAyw9EvS8OYdCu NFdPm/ve06g3ADaoUBXDZACHD3EqeYqggHcRbiNKa1WurTnpz5SXWU+pTWmNvSmYl+fT I7HVOBbVPOPtctSxkdpzZVBC5IBY3WmUdVHsfkpdcAhp1Tm3EH2p2vJOaa4fkZRDFpfY YhNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0EmvdC7zUHDxE/5ghIc63e3wsGY/KRQ1uaVrsQ4TXdQ=; b=aXF9KPis6S9f+ZmAiypmWl4l+cYQQNoV7kLsm27+rz1zRvufoh0KDh011X9gsiMbNT bxgmNlVujA4okwYdkZ7WmDtyaoeQWi2m08Rb0Fe7vryVZ7sWIXGTNDu3SMSCd3P45qX9 63xMeuL62nIsEUsHcWA34+loi8Fp4V9yAxiE1+BDOPfGEkBzorlVOpYYPN0rjGtH3XXn aKmWgWp1eXUsMBlMMtl+RNO1l0WgmAImIq8N5O7FpKGDPC3O3pyT9F7vk8xnu3NP+RGk Xx3UhG29toW+AnL28VtSQ5OUmCcaosa37hplXBi6rWXJaKnLsNsEVS35IQRtD6a3OYfQ r1dw== X-Gm-Message-State: AHPjjUj8VWte/s9iv/wIkLbyM9K5GNYYetAaLSEY019j11HepZsiCLnD YNlyqPn27PNMpw== X-Google-Smtp-Source: ADKCNb7xUetESYhF3F8Pb1VMih3EnyMtJ8iugnTas33h0eeVlcACg738v/sLWR3bTP/RKmtRzVrDoQ== X-Received: by 10.98.149.208 with SMTP id c77mr2823588pfk.330.1504597281441; Tue, 05 Sep 2017 00:41:21 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id h185sm276890pfe.160.2017.09.05.00.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Sep 2017 00:41:20 -0700 (PDT) From: Nicolin Chen To: rui.zhang@intel.com Cc: edubezval@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, wni@nvidia.com, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, srikars@nvidia.com Subject: [PATCH v2] thermal: tegra: remove null check for dev pointer Date: Tue, 5 Sep 2017 00:41:16 -0700 Message-Id: <1504597276-22924-1-git-send-email-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The dev pointer is going through a null check after a dereference. So this patch removes that useless check since the driver does not pass a null dev pointer in any case. Signed-off-by: Nicolin Chen --- Changelog v2: * By following Thierry's comments, changed to remove the null pointer check directly and revised the patch subject according. drivers/thermal/tegra/soctherm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index 7d2db23..075db1d 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -483,7 +483,7 @@ static int throttrip_program(struct device *dev, unsigned int throt; u32 r, reg_off; - if (!dev || !sg || !stc || !stc->init) + if (!sg || !stc || !stc->init) return -EINVAL; temp = enforce_temp_range(dev, trip_temp) / ts->soc->thresh_grain;