[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZeLdpNGXqkDlU3MU@x130>
Date: Sat, 2 Mar 2024 00:04:52 -0800
From: Saeed Mahameed <saeed@...nel.org>
To: Vegard Nossum <vegard.nossum@...cle.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Leon Romanovsky <leonro@...dia.com>,
Jason Gunthorpe <jgg@...dia.com>, Jiri Pirko <jiri@...dia.com>,
Leonid Bloch <lbloch@...dia.com>, Itay Avraham <itayavr@...dia.com>,
Jakub Kicinski <kuba@...nel.org>,
Saeed Mahameed <saeedm@...dia.com>,
David Ahern <dsahern@...nel.org>,
Aron Silverton <aron.silverton@...cle.com>,
Christoph Hellwig <hch@...radead.org>,
andrew.gospodarek@...adcom.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V4 2/5] misc: mlx5ctl: Add mlx5ctl misc driver
On 29 Feb 12:44, Vegard Nossum wrote:
>
>On 07/02/2024 08:24, Saeed Mahameed wrote:
>>+static int mlx5ctl_open(struct inode *inode, struct file *file)
>>+{
>>+ struct mlx5_core_dev *mdev;
>>+ struct mlx5ctl_dev *mcdev;
>>+ struct mlx5ctl_fd *mfd;
>>+ int err = 0;
>>+
>>+ mcdev = container_of(file->private_data, struct mlx5ctl_dev, miscdev);
>>+ mcdev_get(mcdev);
>>+ down_read(&mcdev->rw_lock);
>>+ mdev = mcdev->mdev;
>>+ if (!mdev) {
>>+ err = -ENODEV;
>>+ goto unlock;
>>+ }
>>+
>>+ mfd = kzalloc(sizeof(*mfd), GFP_KERNEL_ACCOUNT);
>>+ if (!mfd)
>>+ return -ENOMEM;
>
>goto unlock?
>
>Or why not reorder so you always allocate this before doing anything else?
Good catch !, thanks I will reorder.
Powered by blists - more mailing lists