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 C5E6ECD13CF for ; Mon, 2 Sep 2024 11:14:30 +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=trOQbSRctpSwONXeBlAgxscj+bT35QMgk51a13CNx/U=; b=zqpj5a2ixGiJuKYOK+JmWUZk7G QifCvZ+Eg/7Ww3c3NFOFsIPWsqmqVYt28NAluOQn81xMiOrqtcRe3K3aTQlqkjMP0vR2SxL/FJlh4 rHfomRgwWXGSb2nVvCg9zp3K+bjyHpdSyxDRMGknbegqbUK4JzrSGGwcSrt/YGMhMpaV8PgB2xAMi uSrBUjduBHWU+X8RHkE9sn53eV+kT2ooLtkR5tchDp7cvPoH3YCe5PZ+wyB0GOmht4yJb0fQsuRut A5wffOuEsxecvy1ffGtdmUc8blONHuv0AhbLVmvJwhh/swvVzewSNn5ojQsPy/NPYMHocgsFIt+GW 9YyEOqwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl50m-0000000E4ay-1rz1; Mon, 02 Sep 2024 11:14:20 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl4zs-0000000E4N3-2IZY for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2024 11:13:26 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-367990aaef3so2464807f8f.0 for ; Mon, 02 Sep 2024 04:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725275597; x=1725880397; 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=trOQbSRctpSwONXeBlAgxscj+bT35QMgk51a13CNx/U=; b=s+irMGHmaMLaAFqZR/injctNddSg7Uk1yPN0NAjmjHHLTNDumXtmn2hq/8busMTe3j GYrV4jHonEGx6S8h2ItctRdehqlcN0qxW19cGyoeuMtYgoqGyCMQ5Oo+g/5yUHADN8L/ Pw+gSrTRO2F1jLgFjzm7VjtEnSpDJ5AHmZLnyhYEvCvKdgbqrSC3sUenBF8WUjdygFYx 8XE8PVd2Xm5wdGReU5Iv72SPgbrGJDZ5+zZv2RMAczLcIn3+KC9+QcepRRSXQtxj3ZHI 51a3z9rQ5v81RAHYmxtw28+fgd4atVeIeo3FuVvhXMN4TmgbP9EggFZ6ZfxJkJkgWFnE z+rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725275597; x=1725880397; 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=trOQbSRctpSwONXeBlAgxscj+bT35QMgk51a13CNx/U=; b=U1nIrjK228pYJ8L+LOWAb1ZtUt11NEV0fxY2lAVclZxDw+/lkDTyVdxctys84usTta ZTPXOnlMtJTs7cH0N+5yBuvPzo9QJtkm+EIfbVnt4AfclHDUear1WWdCM1dg7AhuMY9X J2HqbNRpGUcpmVjYINlOm23FA16oUxxO0+hnOAhbSf+FaR4UQ2zvjUD3cfu/8NNxaf3s bF9Q9dJ9SgFiPAGQsyhE1zr1RFtcmUPfJoKRJ8MEK/rCnSuZh0onnUywWNCYP7/dxCei 7euzWj81i+8JxvU3wHH4DcjPIzJ1GHNIcRvYd8atvwt+VyD4FbiiZc6Q64b/ym+sfp2j xzPQ== X-Forwarded-Encrypted: i=1; AJvYcCVn5Ar5Ci8DtlyEw7hR923fXsb7yWr+JWg+DIVifJb1tezSptxXXz/Z1LFvgQUKhXh9NnKwjxRaz6RMvl2yIphI@lists.infradead.org X-Gm-Message-State: AOJu0Yyr7TxRzx5448VtHpFfyYO+ogWtb4zc0kobchcb24migIpB/Gfm hx5qxDfGzFHU5YgfJ/VXOafjy8NfmkzVHrwOYVcGsM9/DBK+UkicbOyn7ZsNPA== X-Google-Smtp-Source: AGHT+IH7woCYVNiEDZabuscEJviasxR5ir6EOYwiqiG+6QJsMqDLh27XmLT7jAvAWCyzW79uw/yBHQ== X-Received: by 2002:a5d:522d:0:b0:374:c4e2:ee00 with SMTP id ffacd0b85a97d-374c4e2f17dmr2647937f8f.53.1725275597192; Mon, 02 Sep 2024 04:13:17 -0700 (PDT) Received: from google.com (203.75.199.104.bc.googleusercontent.com. [104.199.75.203]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e27c70sm134013705e9.35.2024.09.02.04.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 04:13:16 -0700 (PDT) Date: Mon, 2 Sep 2024 12:13:12 +0100 From: Vincent Donnefort To: Marc Zyngier Cc: Sebastian Ene , 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: <865xriw161.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_041324_607714_67B9144B X-CRM114-Status: GOOD ( 14.47 ) 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 [...] > > > +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? [...]