diff options
author | Viresh Kumar <viresh.kumar@st.com> | 2011-08-05 06:02:29 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2011-08-25 10:03:37 -0400 |
commit | b201c111c87a4cf36d009abe57c62bd14d17d762 (patch) | |
tree | 5050103fd6bb6eff77c6c0c7ce7ee51d25a78bcb /drivers/dma/amba-pl08x.c | |
parent | 0c38d70139138713e66c6f98e19a0320014476ff (diff) |
dmaengine/amba-pl08x: pass (*ptr) to sizeof() instead of (struct xyz)
As mentioned in Documentation/CodingStyle,
The preferred form for passing a size of a struct is the following:
p = kmalloc(sizeof(*p), ...);
The alternative form where struct name is spelled out hurts readability and
introduces an opportunity for a bug when the pointer variable type is changed
but the corresponding sizeof that is passed to a memory allocator is not.
This patch replaces (struct xyz) with *ptr at several occurrences in driver.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/amba-pl08x.c')
-rw-r--r-- | drivers/dma/amba-pl08x.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 8e2056bf1623..01c2f507e950 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -1293,7 +1293,7 @@ static int pl08x_prep_channel_resources(struct pl08x_dma_chan *plchan, | |||
1293 | static struct pl08x_txd *pl08x_get_txd(struct pl08x_dma_chan *plchan, | 1293 | static struct pl08x_txd *pl08x_get_txd(struct pl08x_dma_chan *plchan, |
1294 | unsigned long flags) | 1294 | unsigned long flags) |
1295 | { | 1295 | { |
1296 | struct pl08x_txd *txd = kzalloc(sizeof(struct pl08x_txd), GFP_NOWAIT); | 1296 | struct pl08x_txd *txd = kzalloc(sizeof(*txd), GFP_NOWAIT); |
1297 | 1297 | ||
1298 | if (txd) { | 1298 | if (txd) { |
1299 | dma_async_tx_descriptor_init(&txd->tx, &plchan->chan); | 1299 | dma_async_tx_descriptor_init(&txd->tx, &plchan->chan); |
@@ -1690,7 +1690,7 @@ static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x, | |||
1690 | * to cope with that situation. | 1690 | * to cope with that situation. |
1691 | */ | 1691 | */ |
1692 | for (i = 0; i < channels; i++) { | 1692 | for (i = 0; i < channels; i++) { |
1693 | chan = kzalloc(sizeof(struct pl08x_dma_chan), GFP_KERNEL); | 1693 | chan = kzalloc(sizeof(*chan), GFP_KERNEL); |
1694 | if (!chan) { | 1694 | if (!chan) { |
1695 | dev_err(&pl08x->adev->dev, | 1695 | dev_err(&pl08x->adev->dev, |
1696 | "%s no memory for channel\n", __func__); | 1696 | "%s no memory for channel\n", __func__); |
@@ -1850,7 +1850,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) | |||
1850 | return ret; | 1850 | return ret; |
1851 | 1851 | ||
1852 | /* Create the driver state holder */ | 1852 | /* Create the driver state holder */ |
1853 | pl08x = kzalloc(sizeof(struct pl08x_driver_data), GFP_KERNEL); | 1853 | pl08x = kzalloc(sizeof(*pl08x), GFP_KERNEL); |
1854 | if (!pl08x) { | 1854 | if (!pl08x) { |
1855 | ret = -ENOMEM; | 1855 | ret = -ENOMEM; |
1856 | goto out_no_pl08x; | 1856 | goto out_no_pl08x; |
@@ -1929,7 +1929,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) | |||
1929 | } | 1929 | } |
1930 | 1930 | ||
1931 | /* Initialize physical channels */ | 1931 | /* Initialize physical channels */ |
1932 | pl08x->phy_chans = kmalloc((vd->channels * sizeof(struct pl08x_phy_chan)), | 1932 | pl08x->phy_chans = kmalloc((vd->channels * sizeof(*pl08x->phy_chans)), |
1933 | GFP_KERNEL); | 1933 | GFP_KERNEL); |
1934 | if (!pl08x->phy_chans) { | 1934 | if (!pl08x->phy_chans) { |
1935 | dev_err(&adev->dev, "%s failed to allocate " | 1935 | dev_err(&adev->dev, "%s failed to allocate " |