Skip to content

Commit 18ea671

Browse files
committed
Merge tag 'dmaengine-fix-5.6-rc1' of git://git.infradead.org/users/vkoul/slave-dma
Pull dmaengine fixes from Vinod Koul: "Fixes for: - Documentation build error fix - Fix dma_request_chan() error return - Remove unneeded conversion in idxd driver - Fix pointer check for dma_async_device_channel_register() - Fix slave-channel symlink cleanup" * tag 'dmaengine-fix-5.6-rc1' of git://git.infradead.org/users/vkoul/slave-dma: dmaengine: Cleanups for the slave <-> channel symlink support dmaengine: fix null ptr check for __dma_async_device_channel_register() dmaengine: idxd: fix boolconv.cocci warnings dmaengine: Fix return value for dma_request_chan() in case of failure dmaengine: doc: Properly indent metadata title
2 parents 4fc2ea6 + bad8356 commit 18ea671

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

Documentation/driver-api/dmaengine/client.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ The details of these operations are:
151151
Note that callbacks will always be invoked from the DMA
152152
engines tasklet, never from interrupt context.
153153

154-
Optional: per descriptor metadata
155-
---------------------------------
154+
Optional: per descriptor metadata
155+
---------------------------------
156156
DMAengine provides two ways for metadata support.
157157

158158
DESC_METADATA_CLIENT

drivers/dma/dmaengine.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -756,22 +756,21 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
756756
}
757757
mutex_unlock(&dma_list_mutex);
758758

759-
if (!IS_ERR_OR_NULL(chan))
760-
goto found;
761-
762-
return ERR_PTR(-EPROBE_DEFER);
759+
if (IS_ERR_OR_NULL(chan))
760+
return chan ? chan : ERR_PTR(-EPROBE_DEFER);
763761

764762
found:
765-
chan->slave = dev;
766763
chan->name = kasprintf(GFP_KERNEL, "dma:%s", name);
767764
if (!chan->name)
768-
return ERR_PTR(-ENOMEM);
765+
return chan;
766+
chan->slave = dev;
769767

770768
if (sysfs_create_link(&chan->dev->device.kobj, &dev->kobj,
771769
DMA_SLAVE_NAME))
772-
dev_err(dev, "Cannot create DMA %s symlink\n", DMA_SLAVE_NAME);
770+
dev_warn(dev, "Cannot create DMA %s symlink\n", DMA_SLAVE_NAME);
773771
if (sysfs_create_link(&dev->kobj, &chan->dev->device.kobj, chan->name))
774-
dev_err(dev, "Cannot create DMA %s symlink\n", chan->name);
772+
dev_warn(dev, "Cannot create DMA %s symlink\n", chan->name);
773+
775774
return chan;
776775
}
777776
EXPORT_SYMBOL_GPL(dma_request_chan);
@@ -830,13 +829,14 @@ void dma_release_channel(struct dma_chan *chan)
830829
/* drop PRIVATE cap enabled by __dma_request_channel() */
831830
if (--chan->device->privatecnt == 0)
832831
dma_cap_clear(DMA_PRIVATE, chan->device->cap_mask);
832+
833833
if (chan->slave) {
834+
sysfs_remove_link(&chan->dev->device.kobj, DMA_SLAVE_NAME);
834835
sysfs_remove_link(&chan->slave->kobj, chan->name);
835836
kfree(chan->name);
836837
chan->name = NULL;
837838
chan->slave = NULL;
838839
}
839-
sysfs_remove_link(&chan->dev->device.kobj, DMA_SLAVE_NAME);
840840
mutex_unlock(&dma_list_mutex);
841841
}
842842
EXPORT_SYMBOL_GPL(dma_release_channel);
@@ -962,6 +962,9 @@ static int __dma_async_device_channel_register(struct dma_device *device,
962962

963963
tchan = list_first_entry_or_null(&device->channels,
964964
struct dma_chan, device_node);
965+
if (!tchan)
966+
return -ENODEV;
967+
965968
if (tchan->dev) {
966969
idr_ref = tchan->dev->idr_ref;
967970
} else {

drivers/dma/idxd/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static inline bool is_idxd_wq_dmaengine(struct idxd_wq *wq)
6666

6767
static inline bool is_idxd_wq_cdev(struct idxd_wq *wq)
6868
{
69-
return wq->type == IDXD_WQT_USER ? true : false;
69+
return wq->type == IDXD_WQT_USER;
7070
}
7171

7272
static int idxd_config_bus_match(struct device *dev,

0 commit comments

Comments
 (0)