From nobody Mon Apr 6 06:09:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92726C4167B for ; Fri, 30 Sep 2022 23:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbiI3XYZ (ORCPT ); Fri, 30 Sep 2022 19:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbiI3XYS (ORCPT ); Fri, 30 Sep 2022 19:24:18 -0400 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73F3E138F28; Fri, 30 Sep 2022 16:24:12 -0700 (PDT) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 07C17E0EB3; Fri, 30 Sep 2022 01:46:55 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=Vx5QSi8OG8I5TDDjDN/aJB31I8qaTz0i56lsAmojCc0=; b=oC95j9nfLRMq 6QQ26lh7oDVyH8p15LwfloY4UKNJWrwMY695jLiYtQT2qM9iAsm9PrC1Ld4v/70b bX96x+LTbE7c8ndZqS746wS5dzopkTolZj4/6owZasYtcBJn6oQJGtFfSRZvWlQW B06YUq+/qMhhLRRQh8G1ghmVqovzU7w= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id ECC23E0E6B; Fri, 30 Sep 2022 01:46:54 +0300 (MSK) Received: from localhost (192.168.168.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 30 Sep 2022 01:46:55 +0300 From: Serge Semin To: Jens Axboe , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Thomas Bogendoerfer , , , Subject: [PATCH v2 1/3] nvme-hwmon: Return error on kzalloc failure Date: Fri, 30 Sep 2022 01:46:46 +0300 Message-ID: <20220929224648.8997-2-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220929224648.8997-1-Sergey.Semin@baikalelectronics.ru> References: <20220929224648.8997-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.168.10] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Inability to allocate a buffer is a critical error which shouldn't be tolerated since most likely the rest of the driver won't work correctly. Thus instead of returning the zero status let's return the -ENOMEM error if the nvme_hwmon_data structure instance couldn't be created. Signed-off-by: Serge Semin --- Changelog v2: - New patch --- drivers/nvme/host/hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c index 0a586d712920..1afb24a64145 100644 --- a/drivers/nvme/host/hwmon.c +++ b/drivers/nvme/host/hwmon.c @@ -230,7 +230,7 @@ int nvme_hwmon_init(struct nvme_ctrl *ctrl) =20 data =3D kzalloc(sizeof(*data), GFP_KERNEL); if (!data) - return 0; + return -ENOMEM; =20 data->ctrl =3D ctrl; mutex_init(&data->read_lock); --=20 2.37.3