From patchwork Sat Jul 7 06:53:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 940758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=osadl.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41N3dY20vYz9s19 for ; Sat, 7 Jul 2018 17:49:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbeGGHtT (ORCPT ); Sat, 7 Jul 2018 03:49:19 -0400 Received: from www.osadl.org ([62.245.132.105]:53261 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbeGGHtT (ORCPT ); Sat, 7 Jul 2018 03:49:19 -0400 X-Greylist: delayed 3126 seconds by postgrey-1.27 at vger.kernel.org; Sat, 07 Jul 2018 03:49:19 EDT Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w676riMM028512; Sat, 7 Jul 2018 08:53:44 +0200 From: Nicholas Mc Guire To: "Author: Paul Mackerras" Cc: Benjamin Herrenschmidt , Michael Ellerman , kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] KVM: PPC: Book3S HV: add of_node_put() in success path Date: Sat, 7 Jul 2018 08:53:07 +0200 Message-Id: <1530946387-6607-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org The call to of_find_compatible_node() is returning a pointer with incremented refcount so it must be explicitly decremented after the last use. As here it is only being used for checking of node presence but the result is not actually used in the success path it can be dropped immediately. Signed-off-by: Nicholas Mc Guire Fixes: commit f725758b899f ("KVM: PPC: Book3S HV: Use OPAL XICS emulation on POWER9") --- Problem found by experimental coccinelle script Patch was compiletested with: ppc64_defconfig (implies CONFIG_KVM=y, CONFIG_KVM_BOOK3S_64_HV=m) with many sparse warnings though not related to the proposed change Patch is against 4.18-rc3 (localversion-next is next-20180705) arch/powerpc/kvm/book3s_hv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index ee4a885..8680fb9 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -4561,6 +4561,8 @@ static int kvmppc_book3s_init_hv(void) pr_err("KVM-HV: Cannot determine method for accessing XICS\n"); return -ENODEV; } + /* presence of intc confirmed - node can be dropped again */ + of_node_put(np); } #endif