From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4547ECA0ED3 for ; Mon, 2 Sep 2024 13:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h0imZkgHwv/FFSZ/weDFaOI5QGpkoprAXSenH7V5Z+0=; b=AdXaZK/r0+r9u5fo7OxR3yJlS5 kVZDobktsGGewN6PqGAd6xSiBSUiWMI95CRZw0rj3Od5/G5YRs9VD4DHztHuUlL9oDvRz33l8eNRp L9tvOX3GJMzX646Lkp6mFQlv0YqsX2hz/ykHMdhQlTlrFUE+4o9m7ocLCzYlx9EFIgBsGwSfrAnWT lslUYWUfEfElhwmzNgAfUETq6kxHqmcXq8FlK6DiL3RnAt0rLZAip8QhkJpz0FY3xAuTdTF/Hexxn DlBIa1f+HzyfQXdniBVLlSemOOLZpAvDU0GOniXqEGCg3d5I7LYDjiogSDARMoFNAZqClqHI4ngFO vP6X0JUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl7OT-0000000EXrg-37GE; Mon, 02 Sep 2024 13:46:57 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl7NY-0000000EXev-0yjf for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2024 13:46:01 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-429d1a9363aso76445e9.1 for ; Mon, 02 Sep 2024 06:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725284758; x=1725889558; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=h0imZkgHwv/FFSZ/weDFaOI5QGpkoprAXSenH7V5Z+0=; b=a9jhVGUOOjhaAl/FlsjuiQrHhr/YM/7NNRu1eLA4Yj4eudMtAF4YpYbUw15RXVGLn4 4SA/L6WM7hyNYF2oJyMUzXN7BPMgA91p2BtvumbX/v/+dL0sHdhrMBpOaXB0ZV33CTXh GQkKSWhkGQGtc1NL8rTSqh+50dHs+i9cJ/JPOnmu5oahQkmP9Ym/Lvtv6s/A07UCbJ6w l4DoA6vCwWqycBEzJQGPTyNgt+7rrFhv8E4xHoukJk1KXR08n84x3GpAO1Ezcm0Kufr8 4cLD+5/34pKJv1NVRjkLbN8TfvVgFMb1xNqIjAK7Lu/igaIthEN6hZMF+lFZxEGY53zQ jV6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725284758; x=1725889558; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=h0imZkgHwv/FFSZ/weDFaOI5QGpkoprAXSenH7V5Z+0=; b=w+v5icuzcxWTFX6tUvU6CJb+zQW4x14sRJ40538piTqoy9yCvqlSBrw5yJmqv+mpOn IU6kwxS7Qk6fgFcNKcwmUmyi7zkpBbQCAZmF172S3tXqytT0iHIQ6+UmTaHGl9YxDNFA tecBEpWioXPwwwMFba3b3Xn4y7/ielo0aL9dJiNgonWGsBjl4xy8qlyJ14fqDUumpv7l /h7zqIEytFo/HOPOsinggL2jlaDy2CYhfS8mEL/NsmS0hg3oRg/WhCG0Gt92Vri+RzLd o8k2rwuIlPFIBDXEPwN+zWHS0a877ny6gBO3KW78hEcnuI2E4go3EKCm0IhTnCmAdohO gLkg== X-Forwarded-Encrypted: i=1; AJvYcCUmZBbvTL/2hZYnvenz/yq8FAIc37zH3DKC+fppuDnp+vws0/s284VzRbduHoeeYchQuuxMVgH0DZCLGRtxPJV6@lists.infradead.org X-Gm-Message-State: AOJu0YxfI325oySu9MYC0CaNNrma4OIxXnbnrvWufJGyFPugnG54HxJA VGo1YUtlq4RTOz1lRgV90nvHDQCCrgHCf31g3BgGKTstmbM9cpIw/BJ4IlJ2nQ== X-Google-Smtp-Source: AGHT+IHfmxWe7A8SIdoui0sTmiBSuRgFc0ExDXB96UvRo3zFmjQuhTAROm1VQW7ctx3emLZKd2x6sA== X-Received: by 2002:a05:600c:b8e:b0:426:7018:2e2f with SMTP id 5b1f17b1804b1-42c78770e08mr2096735e9.5.1725284758212; Mon, 02 Sep 2024 06:45:58 -0700 (PDT) Received: from google.com (44.232.78.34.bc.googleusercontent.com. [34.78.232.44]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42c17fed40csm89809845e9.0.2024.09.02.06.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 06:45:57 -0700 (PDT) Date: Mon, 2 Sep 2024 13:45:56 +0000 From: Sebastian Ene To: Vincent Donnefort Cc: Marc Zyngier , akpm@linux-foundation.org, alexghiti@rivosinc.com, ankita@nvidia.com, ardb@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, james.morse@arm.com, mark.rutland@arm.com, oliver.upton@linux.dev, rananta@google.com, ryan.roberts@arm.com, shahuang@redhat.com, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v9 4/5] KVM: arm64: Register ptdump with debugfs on guest creation Message-ID: References: <20240827084549.45731-1-sebastianene@google.com> <20240827084549.45731-5-sebastianene@google.com> <865xriw161.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_064600_295883_4B25B183 X-CRM114-Status: GOOD ( 18.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 02, 2024 at 12:13:12PM +0100, Vincent Donnefort wrote: > [...] > > > > > +static int kvm_ptdump_guest_open(struct inode *m, struct file *file) > > > > +{ > > > > + struct kvm *kvm = m->i_private; > > > > + struct kvm_ptdump_guest_state *st; > > > > + int ret; > > > > + > > > > + if (!kvm_get_kvm_safe(kvm)) > > > > + return -ENOENT; > > > > + > > > > + st = kvm_ptdump_parser_create(kvm); > > > > + if (IS_ERR(st)) { > > > > + ret = PTR_ERR(st); > > > > + goto free_with_kvm_ref; > > > > + } > > > > + > > > > + ret = single_open(file, kvm_ptdump_guest_show, st); > > > > + if (!ret) > > > > + return 0; > > > > + > > > > + kfree(st); > > > > +free_with_kvm_ref: > > > > > > nit: I believe kfree understands IS_ERR() so you could have a simple "err:" > > > label covering all the error path. > > > > I couldn't find such handling in kfree(). Could you point be to it? > > My aplogies, I was confused by the DEFINE_FREE(kfree ...) for __free(). kfree() > only checks for null ptr. > > Although, I wonder if the naming "free_with_kvm_ref" isn't an artifact from > previous code? Nothing is freeed here. So perhaps err_with_kvm_ref? which could > be shorten as this is the only label? > > [...] Yes, I guess that works better. Thanks for checking, Seb