Commit 6a965ee1 authored by Tomas Henzl's avatar Tomas Henzl Committed by Martin K. Petersen

scsi: mpt3sas: Suppress a warning in debug kernel

The mpt3sas_ctl_exit() should be called after communication with the
controller stops but currently it may cause false warnings about not
released memory. Fix this by letting mpt3sas_ctl_exit() handle misc driver
release per driver and release DMA in mpt3sas_ctl_release() per ioc.
Signed-off-by: default avatarTomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20231019153706.7967-1-thenzl@redhat.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4f6dd2a4
...@@ -1981,6 +1981,7 @@ extern const struct attribute_group *mpt3sas_host_groups[]; ...@@ -1981,6 +1981,7 @@ extern const struct attribute_group *mpt3sas_host_groups[];
extern const struct attribute_group *mpt3sas_dev_groups[]; extern const struct attribute_group *mpt3sas_dev_groups[];
void mpt3sas_ctl_init(ushort hbas_to_enumerate); void mpt3sas_ctl_init(ushort hbas_to_enumerate);
void mpt3sas_ctl_exit(ushort hbas_to_enumerate); void mpt3sas_ctl_exit(ushort hbas_to_enumerate);
void mpt3sas_ctl_release(struct MPT3SAS_ADAPTER *ioc);
u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
u32 reply); u32 reply);
void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc); void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc);
......
...@@ -4157,17 +4157,14 @@ mpt3sas_ctl_init(ushort hbas_to_enumerate) ...@@ -4157,17 +4157,14 @@ mpt3sas_ctl_init(ushort hbas_to_enumerate)
} }
/** /**
* mpt3sas_ctl_exit - exit point for ctl * mpt3sas_ctl_release - release dma for ctl
* @hbas_to_enumerate: ? * @ioc: per adapter object
*/ */
void void
mpt3sas_ctl_exit(ushort hbas_to_enumerate) mpt3sas_ctl_release(struct MPT3SAS_ADAPTER *ioc)
{ {
struct MPT3SAS_ADAPTER *ioc;
int i; int i;
list_for_each_entry(ioc, &mpt3sas_ioc_list, list) {
/* free memory associated to diag buffers */ /* free memory associated to diag buffers */
for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) { for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
if (!ioc->diag_buffer[i]) if (!ioc->diag_buffer[i])
...@@ -4181,7 +4178,16 @@ mpt3sas_ctl_exit(ushort hbas_to_enumerate) ...@@ -4181,7 +4178,16 @@ mpt3sas_ctl_exit(ushort hbas_to_enumerate)
} }
kfree(ioc->event_log); kfree(ioc->event_log);
} }
/**
* mpt3sas_ctl_exit - exit point for ctl
* @hbas_to_enumerate: ?
*/
void
mpt3sas_ctl_exit(ushort hbas_to_enumerate)
{
if (hbas_to_enumerate != 1) if (hbas_to_enumerate != 1)
misc_deregister(&ctl_dev); misc_deregister(&ctl_dev);
if (hbas_to_enumerate != 2) if (hbas_to_enumerate != 2)
......
...@@ -11331,6 +11331,7 @@ static void scsih_remove(struct pci_dev *pdev) ...@@ -11331,6 +11331,7 @@ static void scsih_remove(struct pci_dev *pdev)
} }
mpt3sas_base_detach(ioc); mpt3sas_base_detach(ioc);
mpt3sas_ctl_release(ioc);
spin_lock(&gioc_lock); spin_lock(&gioc_lock);
list_del(&ioc->list); list_del(&ioc->list);
spin_unlock(&gioc_lock); spin_unlock(&gioc_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment