diff options
| -rw-r--r-- | drivers/hid/intel-ish-hid/ipc/ipc.c | 9 | ||||
| -rw-r--r-- | drivers/hid/intel-ish-hid/ipc/pci-ish.c | 13 |
2 files changed, 17 insertions, 5 deletions
diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c index 9a60ec13cb10..bfbca7ec54ce 100644 --- a/drivers/hid/intel-ish-hid/ipc/ipc.c +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c | |||
| @@ -907,8 +907,9 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev) | |||
| 907 | struct ishtp_device *dev; | 907 | struct ishtp_device *dev; |
| 908 | int i; | 908 | int i; |
| 909 | 909 | ||
| 910 | dev = kzalloc(sizeof(struct ishtp_device) + sizeof(struct ish_hw), | 910 | dev = devm_kzalloc(&pdev->dev, |
| 911 | GFP_KERNEL); | 911 | sizeof(struct ishtp_device) + sizeof(struct ish_hw), |
| 912 | GFP_KERNEL); | ||
| 912 | if (!dev) | 913 | if (!dev) |
| 913 | return NULL; | 914 | return NULL; |
| 914 | 915 | ||
| @@ -925,7 +926,9 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev) | |||
| 925 | for (i = 0; i < IPC_TX_FIFO_SIZE; ++i) { | 926 | for (i = 0; i < IPC_TX_FIFO_SIZE; ++i) { |
| 926 | struct wr_msg_ctl_info *tx_buf; | 927 | struct wr_msg_ctl_info *tx_buf; |
| 927 | 928 | ||
| 928 | tx_buf = kzalloc(sizeof(struct wr_msg_ctl_info), GFP_KERNEL); | 929 | tx_buf = devm_kzalloc(&pdev->dev, |
| 930 | sizeof(struct wr_msg_ctl_info), | ||
| 931 | GFP_KERNEL); | ||
| 929 | if (!tx_buf) { | 932 | if (!tx_buf) { |
| 930 | /* | 933 | /* |
| 931 | * IPC buffers may be limited or not available | 934 | * IPC buffers may be limited or not available |
diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index a2c53ea3b5ed..050f9872f5c0 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c | |||
| @@ -95,6 +95,13 @@ static int ish_init(struct ishtp_device *dev) | |||
| 95 | return 0; | 95 | return 0; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | static const struct pci_device_id ish_invalid_pci_ids[] = { | ||
| 99 | /* Mehlow platform special pci ids */ | ||
| 100 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xA309)}, | ||
| 101 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xA30A)}, | ||
| 102 | {} | ||
| 103 | }; | ||
| 104 | |||
| 98 | /** | 105 | /** |
| 99 | * ish_probe() - PCI driver probe callback | 106 | * ish_probe() - PCI driver probe callback |
| 100 | * @pdev: pci device | 107 | * @pdev: pci device |
| @@ -110,6 +117,10 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 110 | struct ish_hw *hw; | 117 | struct ish_hw *hw; |
| 111 | int ret; | 118 | int ret; |
| 112 | 119 | ||
| 120 | /* Check for invalid platforms for ISH support */ | ||
| 121 | if (pci_dev_present(ish_invalid_pci_ids)) | ||
| 122 | return -ENODEV; | ||
| 123 | |||
| 113 | /* enable pci dev */ | 124 | /* enable pci dev */ |
| 114 | ret = pci_enable_device(pdev); | 125 | ret = pci_enable_device(pdev); |
| 115 | if (ret) { | 126 | if (ret) { |
| @@ -172,7 +183,6 @@ free_irq: | |||
| 172 | free_irq(pdev->irq, dev); | 183 | free_irq(pdev->irq, dev); |
| 173 | free_device: | 184 | free_device: |
| 174 | pci_iounmap(pdev, hw->mem_addr); | 185 | pci_iounmap(pdev, hw->mem_addr); |
| 175 | kfree(dev); | ||
| 176 | release_regions: | 186 | release_regions: |
| 177 | pci_release_regions(pdev); | 187 | pci_release_regions(pdev); |
| 178 | disable_device: | 188 | disable_device: |
| @@ -202,7 +212,6 @@ static void ish_remove(struct pci_dev *pdev) | |||
| 202 | pci_release_regions(pdev); | 212 | pci_release_regions(pdev); |
| 203 | pci_clear_master(pdev); | 213 | pci_clear_master(pdev); |
| 204 | pci_disable_device(pdev); | 214 | pci_disable_device(pdev); |
| 205 | kfree(ishtp_dev); | ||
| 206 | } | 215 | } |
| 207 | 216 | ||
| 208 | static struct device __maybe_unused *ish_resume_device; | 217 | static struct device __maybe_unused *ish_resume_device; |
