[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzYwB7lRGW80r4HA@kbusch-mbp.dhcp.thefacebook.com>
Date: Thu, 29 Sep 2022 17:53:43 -0600
From: Keith Busch <kbusch@...nel.org>
To: Serge Semin <Sergey.Semin@...kalelectronics.ru>
Cc: Jens Axboe <axboe@...nel.dk>, Jens Axboe <axboe@...com>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
Serge Semin <fancer.lancer@...il.com>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
linux-nvme@...ts.infradead.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] nvme-hwmon: Return error on kzalloc failure
On Fri, Sep 30, 2022 at 01:46:46AM +0300, Serge Semin wrote:
> 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.
Nak for this one. The hwmon is not necessary for the rest of the driver to
function, so having the driver detach from the device seems a bit harsh. The
driver can participate in memory reclaim, so failing on a low memory condition
can make matters worse.
The rest looks good, though.
> @@ -230,7 +230,7 @@ int nvme_hwmon_init(struct nvme_ctrl *ctrl)
>
> data = kzalloc(sizeof(*data), GFP_KERNEL);
> if (!data)
> - return 0;
> + return -ENOMEM;
>
> data->ctrl = ctrl;
> mutex_init(&data->read_lock);
> --
Powered by blists - more mailing lists