summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/xillybus/xillybus_of.c11
-rw-r--r--drivers/char/xillybus/xillybus_pcie.c10
2 files changed, 2 insertions, 19 deletions
diff --git a/drivers/char/xillybus/xillybus_of.c b/drivers/char/xillybus/xillybus_of.c
index 781865084dc1..78a492f5acfb 100644
--- a/drivers/char/xillybus/xillybus_of.c
+++ b/drivers/char/xillybus/xillybus_of.c
@@ -81,7 +81,6 @@ static int xilly_map_single_of(struct xilly_endpoint *ep,
81{ 81{
82 dma_addr_t addr; 82 dma_addr_t addr;
83 struct xilly_mapping *this; 83 struct xilly_mapping *this;
84 int rc;
85 84
86 this = kzalloc(sizeof(*this), GFP_KERNEL); 85 this = kzalloc(sizeof(*this), GFP_KERNEL);
87 if (!this) 86 if (!this)
@@ -101,15 +100,7 @@ static int xilly_map_single_of(struct xilly_endpoint *ep,
101 100
102 *ret_dma_handle = addr; 101 *ret_dma_handle = addr;
103 102
104 rc = devm_add_action(ep->dev, xilly_of_unmap, this); 103 return devm_add_action_or_reset(ep->dev, xilly_of_unmap, this);
105
106 if (rc) {
107 dma_unmap_single(ep->dev, addr, size, direction);
108 kfree(this);
109 return rc;
110 }
111
112 return 0;
113} 104}
114 105
115static struct xilly_endpoint_hardware of_hw = { 106static struct xilly_endpoint_hardware of_hw = {
diff --git a/drivers/char/xillybus/xillybus_pcie.c b/drivers/char/xillybus/xillybus_pcie.c
index 9418300214e9..dff2d1538164 100644
--- a/drivers/char/xillybus/xillybus_pcie.c
+++ b/drivers/char/xillybus/xillybus_pcie.c
@@ -98,7 +98,6 @@ static int xilly_map_single_pci(struct xilly_endpoint *ep,
98 int pci_direction; 98 int pci_direction;
99 dma_addr_t addr; 99 dma_addr_t addr;
100 struct xilly_mapping *this; 100 struct xilly_mapping *this;
101 int rc;
102 101
103 this = kzalloc(sizeof(*this), GFP_KERNEL); 102 this = kzalloc(sizeof(*this), GFP_KERNEL);
104 if (!this) 103 if (!this)
@@ -120,14 +119,7 @@ static int xilly_map_single_pci(struct xilly_endpoint *ep,
120 119
121 *ret_dma_handle = addr; 120 *ret_dma_handle = addr;
122 121
123 rc = devm_add_action(ep->dev, xilly_pci_unmap, this); 122 return devm_add_action_or_reset(ep->dev, xilly_pci_unmap, this);
124 if (rc) {
125 pci_unmap_single(ep->pdev, addr, size, pci_direction);
126 kfree(this);
127 return rc;
128 }
129
130 return 0;
131} 123}
132 124
133static struct xilly_endpoint_hardware pci_hw = { 125static struct xilly_endpoint_hardware pci_hw = {