Skip to content

Commit bbfdbe9

Browse files
committed
Merge branch 'sh/for-2.6.34' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* 'sh/for-2.6.34' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: sh: fix a number of Oopses and leaks in SH framebuffer driver SH: fix error paths in DMA driver sh: sh7751 pci controller io port fix sh: Fix maximum number of SCIF ports in R2D defconfigs SH: fix TS field shift calculation for DMA drivers
2 parents 722154e + 8bed905 commit bbfdbe9

File tree

6 files changed

+40
-25
lines changed

6 files changed

+40
-25
lines changed

arch/sh/configs/rts7751r2d1_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
877877
#
878878
# CONFIG_SERIAL_MAX3100 is not set
879879
CONFIG_SERIAL_SH_SCI=y
880-
CONFIG_SERIAL_SH_SCI_NR_UARTS=1
880+
CONFIG_SERIAL_SH_SCI_NR_UARTS=2
881881
CONFIG_SERIAL_SH_SCI_CONSOLE=y
882882
CONFIG_SERIAL_CORE=y
883883
CONFIG_SERIAL_CORE_CONSOLE=y

arch/sh/configs/rts7751r2dplus_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
963963
#
964964
# CONFIG_SERIAL_MAX3100 is not set
965965
CONFIG_SERIAL_SH_SCI=y
966-
CONFIG_SERIAL_SH_SCI_NR_UARTS=1
966+
CONFIG_SERIAL_SH_SCI_NR_UARTS=2
967967
CONFIG_SERIAL_SH_SCI_CONSOLE=y
968968
CONFIG_SERIAL_CORE=y
969969
CONFIG_SERIAL_CORE_CONSOLE=y

arch/sh/drivers/pci/pci-sh7751.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/io.h>
1818
#include "pci-sh4.h"
1919
#include <asm/addrspace.h>
20+
#include <asm/sizes.h>
2021

2122
static int __init __area_sdram_check(struct pci_channel *chan,
2223
unsigned int area)
@@ -47,8 +48,8 @@ static int __init __area_sdram_check(struct pci_channel *chan,
4748
static struct resource sh7751_pci_resources[] = {
4849
{
4950
.name = "SH7751_IO",
50-
.start = SH7751_PCI_IO_BASE,
51-
.end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
51+
.start = 0x1000,
52+
.end = SZ_4M - 1,
5253
.flags = IORESOURCE_IO
5354
}, {
5455
.name = "SH7751_mem",

arch/sh/include/cpu-sh4/cpu/dma-register.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ enum {
7676
}
7777

7878
#define TS_INDEX2VAL(i) ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
79-
((((i) >> 2) & 3) << CHCR_TS_HIGH_SHIFT))
79+
(((i) & 0xc) << CHCR_TS_HIGH_SHIFT))
8080

8181
#else /* CONFIG_CPU_SH4A */
8282

drivers/dma/shdma.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
290290
struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
291291
struct sh_desc *desc;
292292
struct sh_dmae_slave *param = chan->private;
293+
int ret;
293294

294295
pm_runtime_get_sync(sh_chan->dev);
295296

@@ -301,11 +302,15 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
301302
struct sh_dmae_slave_config *cfg;
302303

303304
cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
304-
if (!cfg)
305-
return -EINVAL;
305+
if (!cfg) {
306+
ret = -EINVAL;
307+
goto efindslave;
308+
}
306309

307-
if (test_and_set_bit(param->slave_id, sh_dmae_slave_used))
308-
return -EBUSY;
310+
if (test_and_set_bit(param->slave_id, sh_dmae_slave_used)) {
311+
ret = -EBUSY;
312+
goto etestused;
313+
}
309314

310315
param->config = cfg;
311316

@@ -334,10 +339,20 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
334339
}
335340
spin_unlock_bh(&sh_chan->desc_lock);
336341

337-
if (!sh_chan->descs_allocated)
338-
pm_runtime_put(sh_chan->dev);
342+
if (!sh_chan->descs_allocated) {
343+
ret = -ENOMEM;
344+
goto edescalloc;
345+
}
339346

340347
return sh_chan->descs_allocated;
348+
349+
edescalloc:
350+
if (param)
351+
clear_bit(param->slave_id, sh_dmae_slave_used);
352+
etestused:
353+
efindslave:
354+
pm_runtime_put(sh_chan->dev);
355+
return ret;
341356
}
342357

343358
/*

drivers/video/sh_mobile_lcdcfb.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
695695
* 1) Enable Runtime PM
696696
* 2) Force Runtime PM Resume since hardware is accessed from probe()
697697
*/
698+
priv->dev = &pdev->dev;
698699
pm_runtime_enable(priv->dev);
699700
pm_runtime_resume(priv->dev);
700701
return 0;
@@ -957,25 +958,24 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
957958

958959
if (!pdev->dev.platform_data) {
959960
dev_err(&pdev->dev, "no platform data defined\n");
960-
error = -EINVAL;
961-
goto err0;
961+
return -EINVAL;
962962
}
963963

964964
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
965965
i = platform_get_irq(pdev, 0);
966966
if (!res || i < 0) {
967967
dev_err(&pdev->dev, "cannot get platform resources\n");
968-
error = -ENOENT;
969-
goto err0;
968+
return -ENOENT;
970969
}
971970

972971
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
973972
if (!priv) {
974973
dev_err(&pdev->dev, "cannot allocate device data\n");
975-
error = -ENOMEM;
976-
goto err0;
974+
return -ENOMEM;
977975
}
978976

977+
platform_set_drvdata(pdev, priv);
978+
979979
error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
980980
dev_name(&pdev->dev), priv);
981981
if (error) {
@@ -984,8 +984,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
984984
}
985985

986986
priv->irq = i;
987-
priv->dev = &pdev->dev;
988-
platform_set_drvdata(pdev, priv);
989987
pdata = pdev->dev.platform_data;
990988

991989
j = 0;
@@ -1099,9 +1097,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
10991097
info = ch->info;
11001098

11011099
if (info->fbdefio) {
1102-
priv->ch->sglist = vmalloc(sizeof(struct scatterlist) *
1100+
ch->sglist = vmalloc(sizeof(struct scatterlist) *
11031101
info->fix.smem_len >> PAGE_SHIFT);
1104-
if (!priv->ch->sglist) {
1102+
if (!ch->sglist) {
11051103
dev_err(&pdev->dev, "cannot allocate sglist\n");
11061104
goto err1;
11071105
}
@@ -1126,9 +1124,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
11261124
}
11271125

11281126
return 0;
1129-
err1:
1127+
err1:
11301128
sh_mobile_lcdc_remove(pdev);
1131-
err0:
1129+
11321130
return error;
11331131
}
11341132

@@ -1139,7 +1137,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
11391137
int i;
11401138

11411139
for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
1142-
if (priv->ch[i].info->dev)
1140+
if (priv->ch[i].info && priv->ch[i].info->dev)
11431141
unregister_framebuffer(priv->ch[i].info);
11441142

11451143
sh_mobile_lcdc_stop(priv);
@@ -1162,7 +1160,8 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
11621160
if (priv->dot_clk)
11631161
clk_put(priv->dot_clk);
11641162

1165-
pm_runtime_disable(priv->dev);
1163+
if (priv->dev)
1164+
pm_runtime_disable(priv->dev);
11661165

11671166
if (priv->base)
11681167
iounmap(priv->base);

0 commit comments

Comments
 (0)