gpu: nvgpu: use correct err from device_create

When device_create fails, take PTR_ERR from the subdev that was
returned. Commit e8bac374c0 ("gpu: nvgpu: Use device instead of
platform_device") refactored this code but forgot to rename the error
retrieval.

Change-Id: Id01adac431da77a71c8e71e1b01a065826f5ebcf
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2673712
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Konsta Hölttä
2022-02-22 12:23:19 +02:00
committed by mobile promotions
parent ad74b20cca
commit 086909ddd0

View File

@@ -1,7 +1,7 @@
/* /*
* NVGPU IOCTLs * NVGPU IOCTLs
* *
* Copyright (c) 2011-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2011-2022, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -282,7 +282,7 @@ static int gk20a_create_device(
class->priv_data ? class->priv_data : NULL, class->priv_data ? class->priv_data : NULL,
device_name ? device_name : cdev_name); device_name ? device_name : cdev_name);
if (IS_ERR(subdev)) { if (IS_ERR(subdev)) {
err = PTR_ERR(dev); err = PTR_ERR(subdev);
cdev_del(cdev); cdev_del(cdev);
dev_err(dev, "failed to create %s device for %s\n", dev_err(dev, "failed to create %s device for %s\n",
cdev_name, dev_name(dev)); cdev_name, dev_name(dev));