mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
block: virt-storage: tegra: Fix build for Linux v5.14
For Linux v5.14, the function device_add_disk() has a void return type
and compilation now fails with ...
nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:1162:8:
error: invalid use of void expression
1162 | (void)!device_add_disk(vblkdev->device, vblkdev->gd, NULL);
| ^
Fix the build for kernels prior to v5.15 by not attempting to access
the return value. Finally, for kernels v5.15 and newer, do not ignore
the return value and report an error if device_add_disk() fails.
Bug 4052299
Change-Id: I975f30bc67661eacf74634b5edb70e5ad5fc1a8d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2881453
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
a986d91aa3
commit
06b833d570
@@ -1159,7 +1159,14 @@ static void setup_device(struct vblk_dev *vblkdev)
|
||||
}
|
||||
|
||||
set_capacity(vblkdev->gd, (vblkdev->size / SECTOR_SIZE));
|
||||
(void)!device_add_disk(vblkdev->device, vblkdev->gd, NULL);
|
||||
#if KERNEL_VERSION(5, 15, 0) <= LINUX_VERSION_CODE
|
||||
if (device_add_disk(vblkdev->device, vblkdev->gd, NULL)) {
|
||||
dev_err(vblkdev->device, "Error adding disk!\n");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
device_add_disk(vblkdev->device, vblkdev->gd, NULL);
|
||||
#endif
|
||||
|
||||
if (device_create_file(disk_to_dev(vblkdev->gd),
|
||||
&dev_attr_phys_dev_ro)) {
|
||||
|
||||
Reference in New Issue
Block a user