nvme driver: possible missing `unregister_irq`

From: Dennis Dai
Date: Tue Nov 08 2022 - 12:18:31 EST


Hi all,

I was inspecting the rust nvme driver [1] and would like know if the following
code contains a missing unregister or I missed anything

// nvme.rs:180, in NvmeDevice::setup_io_queues
admin_queue.register_irq(pci_dev)?;
// nvme.rs:186, in NvmeDevice::setup_io_queues
let q_depth = core::cmp::min(...).try_into()?;
// nvme.rs:190, in NvmeDevice::setup_io_queues
let tagset = mq::TagSet::try_new(...)?; //TODO: 1 or 3 on
demand, depending on polling enabled

Line 186 and 190 could abort the execution of
NvmeDevice::setup_io_queues without calling `unregister_irq`.
In the end this could result in an `request_threaded_irq` without a
pairing `free_irq` on failure.
Or is the job done by Rust by auto dropping?

Thank you very much!

[1] https://github.com/metaspace/rust-linux/commit/d88c3744d6cbdf11767e08bad56cbfb67c4c96d0