From patchwork Mon Jan 14 17:40:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Ding X-Patchwork-Id: 1973121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 550E33FD86 for ; Mon, 14 Jan 2013 17:44:31 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tuo1v-0007xt-GV; Mon, 14 Jan 2013 17:41:04 +0000 Received: from mail-qa0-f52.google.com ([209.85.216.52]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tuo1r-0007wp-U8 for linux-arm-kernel@lists.infradead.org; Mon, 14 Jan 2013 17:41:00 +0000 Received: by mail-qa0-f52.google.com with SMTP id d13so1652813qak.18 for ; Mon, 14 Jan 2013 09:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Kiq1T+ts7fgRKvvKR6hXj24UrrYZSNpNlz74PUmrRCE=; b=zLRL3/5/PalFen369ee4TNse/Mzb9tR7FvmVoYMPX8Or/zhtc2gpuAMw/mWwy0K75o ZMEJ5Vv+iXMrmCcrQjgoxYQGqsuzPCcfRGoC8uB71vzw5P4jHK7W7Bge65F+qTgj9r3g ASni+2tunxTtZN+iZRxGH/SXd1/VWDL5Bq8GnQdg5yspqDcM4E/waBvGvT03/OO5+yHG pq2KfzPy8yCv12D3WnU/jb9elTRkpKLfnKbFkh774/Z8rVI1mpb0FXjyjqKDWvjcKn2K kk2Dsr9piXBW0cQG1inhf+BsvDU+rUCc+LTMmdTzcTQRFnSUc5rYsVr8jvVFyBke/LjJ BVPA== X-Received: by 10.224.138.143 with SMTP id a15mr15120860qau.91.1358185258551; Mon, 14 Jan 2013 09:40:58 -0800 (PST) Received: from gmail.com (ec2-54-243-39-165.compute-1.amazonaws.com. [54.243.39.165]) by mx.google.com with ESMTPS id dj2sm9736973qab.9.2013.01.14.09.40.56 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 14 Jan 2013 09:40:57 -0800 (PST) Date: Mon, 14 Jan 2013 17:40:55 +0000 From: Cong Ding To: Will Deacon , Peter Zijlstra , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] arm: kernel/perf_event_cpu.c: remove unnecessary null pointer dereference check Message-ID: <20130114174055.GB917@gmail.com> References: <1358183933-29160-1-git-send-email-dinggnu@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1358183933-29160-1-git-send-email-dinggnu@gmail.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130114_124100_131428_1F477783 X-CRM114-Status: GOOD ( 14.93 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dinggnu[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.52 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The NULL pointer check is not necessary. cpu_pmu_init() is called after cpu_pmu has already been dereferenced by its caller: cpu_pmu = pmu; cpu_pmu->plat_device = pdev; cpu_pmu_init(cpu_pmu); Signed-off-by: Cong Ding --- arch/arm/kernel/perf_event_cpu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index efa5295..43496f6 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c @@ -147,7 +147,7 @@ static void cpu_pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->free_irq = cpu_pmu_free_irq; /* Ensure the PMU has sane values out of reset. */ - if (cpu_pmu && cpu_pmu->reset) + if (cpu_pmu->reset) on_each_cpu(cpu_pmu->reset, cpu_pmu, 1); }