Skip to content

Commit 3dbc35a

Browse files
committed
Merge tag 'staging-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree fixes from Greg KH: "Here are a number of bugfixes for the drivers/staging/ portion of the kernel that have been reported recently. Nothing major here, with maybe the exception of the ramster code can now be built so it is enabled in the build again, and lots of memory leaks that people like to have fixed on their systems. Signed-off-by: Greg Kroah-Hartman <[email protected]>" * tag 'staging-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: android: fix mem leaks in __persistent_ram_init() staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl() staging: iio: hmc5843: Fix crash in probe function. staging/xgifb: fix display on XGI Volari Z11m cards Staging: android: timed_gpio: Fix resource leak in timed_gpio_probe error paths android: make persistent_ram based drivers depend on HAVE_MEMBLOCK staging: iio: ak8975: Remove i2c client data corruption staging: drm/omap: move where DMM driver is registered staging: zsmalloc: fix memory leak Staging: rts_pstor: off by one in for loop staging: ozwpan: Added new maintainer for ozwpan staging:rts_pstor:Avoid "Bad target number" message when probing driver staging:rts_pstor:Fix possible panic by NULL pointer dereference Staging: vt6655-6: check keysize before memcpy() staging/media/as102: Don't call release_firmware() on uninitialized variable staging:iio:core add missing increment of loop index in iio_map_array_unregister() staging: ramster: unbreak my heart staging/vme: Fix module parameters staging: sep: Fix sign of error
2 parents f5ad501 + 474a898 commit 3dbc35a

File tree

23 files changed

+105
-57
lines changed

23 files changed

+105
-57
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6471,6 +6471,7 @@ S: Odd Fixes
64716471
F: drivers/staging/olpc_dcon/
64726472

64736473
STAGING - OZMO DEVICES USB OVER WIFI DRIVER
6474+
M: Rupesh Gujare <[email protected]>
64746475
M: Chris Kelly <[email protected]>
64756476
S: Maintained
64766477
F: drivers/staging/ozwpan/

drivers/staging/android/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ config ANDROID_LOGGER
2727

2828
config ANDROID_PERSISTENT_RAM
2929
bool
30+
depends on HAVE_MEMBLOCK
3031
select REED_SOLOMON
3132
select REED_SOLOMON_ENC8
3233
select REED_SOLOMON_DEC8
3334

3435
config ANDROID_RAM_CONSOLE
3536
bool "Android RAM buffer console"
36-
depends on !S390 && !UML
37+
depends on !S390 && !UML && HAVE_MEMBLOCK
3738
select ANDROID_PERSISTENT_RAM
3839
default n
3940

drivers/staging/android/persistent_ram.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,26 +399,26 @@ static __init
399399
struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc)
400400
{
401401
struct persistent_ram_zone *prz;
402-
int ret;
402+
int ret = -ENOMEM;
403403

404404
prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL);
405405
if (!prz) {
406406
pr_err("persistent_ram: failed to allocate persistent ram zone\n");
407-
return ERR_PTR(-ENOMEM);
407+
goto err;
408408
}
409409

410410
INIT_LIST_HEAD(&prz->node);
411411

412412
ret = persistent_ram_buffer_init(dev_name(dev), prz);
413413
if (ret) {
414414
pr_err("persistent_ram: failed to initialize buffer\n");
415-
return ERR_PTR(ret);
415+
goto err;
416416
}
417417

418418
prz->ecc = ecc;
419419
ret = persistent_ram_init_ecc(prz, prz->buffer_size);
420420
if (ret)
421-
return ERR_PTR(ret);
421+
goto err;
422422

423423
if (prz->buffer->sig == PERSISTENT_RAM_SIG) {
424424
if (buffer_size(prz) > prz->buffer_size ||
@@ -442,6 +442,9 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc)
442442
atomic_set(&prz->buffer->size, 0);
443443

444444
return prz;
445+
err:
446+
kfree(prz);
447+
return ERR_PTR(ret);
445448
}
446449

447450
struct persistent_ram_zone * __init

drivers/staging/android/timed_gpio.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int timed_gpio_probe(struct platform_device *pdev)
8585
struct timed_gpio_platform_data *pdata = pdev->dev.platform_data;
8686
struct timed_gpio *cur_gpio;
8787
struct timed_gpio_data *gpio_data, *gpio_dat;
88-
int i, j, ret = 0;
88+
int i, ret;
8989

9090
if (!pdata)
9191
return -EBUSY;
@@ -108,18 +108,12 @@ static int timed_gpio_probe(struct platform_device *pdev)
108108
gpio_dat->dev.get_time = gpio_get_time;
109109
gpio_dat->dev.enable = gpio_enable;
110110
ret = gpio_request(cur_gpio->gpio, cur_gpio->name);
111-
if (ret >= 0) {
112-
ret = timed_output_dev_register(&gpio_dat->dev);
113-
if (ret < 0)
114-
gpio_free(cur_gpio->gpio);
115-
}
111+
if (ret < 0)
112+
goto err_out;
113+
ret = timed_output_dev_register(&gpio_dat->dev);
116114
if (ret < 0) {
117-
for (j = 0; j < i; j++) {
118-
timed_output_dev_unregister(&gpio_data[i].dev);
119-
gpio_free(gpio_data[i].gpio);
120-
}
121-
kfree(gpio_data);
122-
return ret;
115+
gpio_free(cur_gpio->gpio);
116+
goto err_out;
123117
}
124118

125119
gpio_dat->gpio = cur_gpio->gpio;
@@ -131,6 +125,15 @@ static int timed_gpio_probe(struct platform_device *pdev)
131125
platform_set_drvdata(pdev, gpio_data);
132126

133127
return 0;
128+
129+
err_out:
130+
while (--i >= 0) {
131+
timed_output_dev_unregister(&gpio_data[i].dev);
132+
gpio_free(gpio_data[i].gpio);
133+
}
134+
kfree(gpio_data);
135+
136+
return ret;
134137
}
135138

136139
static int timed_gpio_remove(struct platform_device *pdev)

drivers/staging/iio/inkern.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ int iio_map_array_unregister(struct iio_dev *indio_dev,
8282
ret = -ENODEV;
8383
goto error_ret;
8484
}
85+
i++;
8586
}
8687
error_ret:
8788
mutex_unlock(&iio_map_list_lock);

drivers/staging/iio/magnetometer/ak8975.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ static const int ak8975_index_to_reg[] = {
108108
static int ak8975_write_data(struct i2c_client *client,
109109
u8 reg, u8 val, u8 mask, u8 shift)
110110
{
111-
struct ak8975_data *data = i2c_get_clientdata(client);
111+
struct iio_dev *indio_dev = i2c_get_clientdata(client);
112+
struct ak8975_data *data = iio_priv(indio_dev);
112113
u8 regval;
113114
int ret;
114115

@@ -159,7 +160,8 @@ static int ak8975_read_data(struct i2c_client *client,
159160
*/
160161
static int ak8975_setup(struct i2c_client *client)
161162
{
162-
struct ak8975_data *data = i2c_get_clientdata(client);
163+
struct iio_dev *indio_dev = i2c_get_clientdata(client);
164+
struct ak8975_data *data = iio_priv(indio_dev);
163165
u8 device_id;
164166
int ret;
165167

@@ -509,14 +511,14 @@ static int ak8975_probe(struct i2c_client *client,
509511
goto exit_gpio;
510512
}
511513
data = iio_priv(indio_dev);
514+
i2c_set_clientdata(client, indio_dev);
512515
/* Perform some basic start-of-day setup of the device. */
513516
err = ak8975_setup(client);
514517
if (err < 0) {
515518
dev_err(&client->dev, "AK8975 initialization fails\n");
516519
goto exit_free_iio;
517520
}
518521

519-
i2c_set_clientdata(client, indio_dev);
520522
data->client = client;
521523
mutex_init(&data->lock);
522524
data->eoc_irq = client->irq;

drivers/staging/iio/magnetometer/hmc5843.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,9 @@ static int hmc5843_detect(struct i2c_client *client,
521521
/* Called when we have found a new HMC5843. */
522522
static void hmc5843_init_client(struct i2c_client *client)
523523
{
524-
struct hmc5843_data *data = i2c_get_clientdata(client);
524+
struct iio_dev *indio_dev = i2c_get_clientdata(client);
525+
struct hmc5843_data *data = iio_priv(indio_dev);
526+
525527
hmc5843_set_meas_conf(client, data->meas_conf);
526528
hmc5843_set_rate(client, data->rate);
527529
hmc5843_configure(client, data->operating_mode);

drivers/staging/media/as102/as102_fw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static int as102_firmware_upload(struct as10x_bus_adapter_t *bus_adap,
165165
int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap)
166166
{
167167
int errno = -EFAULT;
168-
const struct firmware *firmware;
168+
const struct firmware *firmware = NULL;
169169
unsigned char *cmd_buf = NULL;
170170
char *fw1, *fw2;
171171
struct usb_device *dev = bus_adap->usb_dev;

drivers/staging/omapdrm/omap_drv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,6 @@ static void pdev_shutdown(struct platform_device *device)
803803
static int pdev_probe(struct platform_device *device)
804804
{
805805
DBG("%s", device->name);
806-
if (platform_driver_register(&omap_dmm_driver))
807-
dev_err(&device->dev, "DMM registration failed\n");
808-
809806
return drm_platform_init(&omap_drm_driver, device);
810807
}
811808

@@ -833,6 +830,10 @@ struct platform_driver pdev = {
833830
static int __init omap_drm_init(void)
834831
{
835832
DBG("init");
833+
if (platform_driver_register(&omap_dmm_driver)) {
834+
/* we can continue on without DMM.. so not fatal */
835+
dev_err(NULL, "DMM registration failed\n");
836+
}
836837
return platform_driver_register(&pdev);
837838
}
838839

drivers/staging/ozwpan/TODO

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ TODO:
88
- code review by USB developer community.
99
- testing with as many devices as possible.
1010

11-
Please send any patches for this driver to Chris Kelly <[email protected]>
11+
Please send any patches for this driver to
12+
Rupesh Gujare <[email protected]>
13+
Chris Kelly <[email protected]>
1214
and Greg Kroah-Hartman <[email protected]>.

drivers/staging/ramster/Kconfig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# Dependency on CONFIG_BROKEN is because there is a commit dependency
2-
# on a cleancache naming change to be submitted by Konrad Wilk
3-
# a39c00ded70339603ffe1b0ffdf3ade85bcf009a "Merge branch 'stable/cleancache.v13'
4-
# into linux-next. Once this commit is present, BROKEN can be removed
51
config RAMSTER
62
bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem"
7-
depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM && BROKEN
3+
depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM
84
select LZO_COMPRESS
95
select LZO_DECOMPRESS
106
default n

drivers/staging/rts_pstor/ms.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32
34983498

34993499
log_blk++;
35003500

3501-
for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) {
3501+
for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1;
3502+
seg_no++) {
35023503
if (log_blk < ms_start_idx[seg_no+1])
35033504
break;
35043505
}

drivers/staging/rts_pstor/rtsx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,11 @@ static int __devinit rtsx_probe(struct pci_dev *pci,
10001000

10011001
rtsx_init_chip(dev->chip);
10021002

1003+
/* set the supported max_lun and max_id for the scsi host
1004+
* NOTE: the minimal value of max_id is 1 */
1005+
host->max_id = 1;
1006+
host->max_lun = dev->chip->max_lun;
1007+
10031008
/* Start up our control thread */
10041009
th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME);
10051010
if (IS_ERR(th)) {

drivers/staging/rts_pstor/rtsx_transport.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
335335
int sg_cnt, i, resid;
336336
int err = 0;
337337
long timeleft;
338+
struct scatterlist *sg_ptr;
338339
u32 val = TRIG_DMA;
339340

340341
if ((sg == NULL) || (num_sg <= 0) || !offset || !index)
@@ -371,22 +372,22 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
371372
sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir);
372373

373374
resid = size;
374-
375+
sg_ptr = sg;
375376
chip->sgi = 0;
376377
/* Usually the next entry will be @sg@ + 1, but if this sg element
377378
* is part of a chained scatterlist, it could jump to the start of
378379
* a new scatterlist array. So here we use sg_next to move to
379380
* the proper sg
380381
*/
381382
for (i = 0; i < *index; i++)
382-
sg = sg_next(sg);
383+
sg_ptr = sg_next(sg_ptr);
383384
for (i = *index; i < sg_cnt; i++) {
384385
dma_addr_t addr;
385386
unsigned int len;
386387
u8 option;
387388

388-
addr = sg_dma_address(sg);
389-
len = sg_dma_len(sg);
389+
addr = sg_dma_address(sg_ptr);
390+
len = sg_dma_len(sg_ptr);
390391

391392
RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n",
392393
(unsigned int)addr, len);
@@ -415,7 +416,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
415416
if (!resid)
416417
break;
417418

418-
sg = sg_next(sg);
419+
sg_ptr = sg_next(sg_ptr);
419420
}
420421

421422
RTSX_DEBUGP("SG table count = %d\n", chip->sgi);

drivers/staging/sep/sep_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3114,17 +3114,17 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
31143114
current->pid);
31153115
if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET,
31163116
&call_status->status)) {
3117-
dev_warn(&sep->pdev->dev,
3117+
dev_dbg(&sep->pdev->dev,
31183118
"[PID%d] dcb prep needed before send msg\n",
31193119
current->pid);
31203120
error = -EPROTO;
31213121
goto end_function;
31223122
}
31233123

31243124
if (!arg) {
3125-
dev_warn(&sep->pdev->dev,
3125+
dev_dbg(&sep->pdev->dev,
31263126
"[PID%d] dcb null arg\n", current->pid);
3127-
error = EINVAL;
3127+
error = -EINVAL;
31283128
goto end_function;
31293129
}
31303130

drivers/staging/vme/devices/vme_pio2_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ static int vector[PIO2_CARDS_MAX];
3535
static int vector_num;
3636
static int level[PIO2_CARDS_MAX];
3737
static int level_num;
38-
static const char *variant[PIO2_CARDS_MAX];
38+
static char *variant[PIO2_CARDS_MAX];
3939
static int variant_num;
4040

41-
static int loopback;
41+
static bool loopback;
4242

4343
static int pio2_match(struct vme_dev *);
4444
static int __devinit pio2_probe(struct vme_dev *);

drivers/staging/vt6655/key.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,9 @@ bool KeybSetDefaultKey (
655655
return (false);
656656
}
657657

658+
if (uKeyLength > MAX_KEY_LEN)
659+
return false;
660+
658661
pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true;
659662
for(ii=0;ii<ETH_ALEN;ii++)
660663
pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;

drivers/staging/vt6656/ioctl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
565565
result = -ENOMEM;
566566
break;
567567
}
568-
pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC);
568+
pNodeList = kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC);
569569
if (pNodeList == NULL) {
570570
result = -ENOMEM;
571571
break;
@@ -601,6 +601,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
601601
}
602602
}
603603
if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) {
604+
kfree(pNodeList);
604605
result = -EFAULT;
605606
break;
606607
}

drivers/staging/vt6656/key.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,9 @@ BOOL KeybSetDefaultKey(
684684
return (FALSE);
685685
}
686686

687+
if (uKeyLength > MAX_KEY_LEN)
688+
return false;
689+
687690
pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE;
688691
for (ii = 0; ii < ETH_ALEN; ii++)
689692
pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;

drivers/staging/xgifb/vb_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension,
6161
}
6262
temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
6363
/* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */
64-
if ((temp & 0x88) == 0x80)
64+
if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08))
6565
data = 0; /* DDR */
6666
else
6767
data = 1; /* DDRII */

drivers/staging/xgifb/vb_setmode.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
152152
pVBInfo->pXGINew_CR97 = &XG20_CR97;
153153

154154
if (ChipType == XG27) {
155+
unsigned char temp;
155156
pVBInfo->MCLKData
156157
= (struct SiS_MCLKData *) XGI27New_MCLKData;
157158
pVBInfo->CR40 = XGI27_cr41;
@@ -162,7 +163,13 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
162163
pVBInfo->pCRDE = XG27_CRDE;
163164
pVBInfo->pSR40 = &XG27_SR40;
164165
pVBInfo->pSR41 = &XG27_SR41;
166+
pVBInfo->SR15 = XG27_SR13;
165167

168+
/*Z11m DDR*/
169+
temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
170+
/* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */
171+
if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08))
172+
pVBInfo->pXGINew_CR97 = &Z11m_CR97;
166173
}
167174

168175
if (ChipType >= XG20) {

0 commit comments

Comments
 (0)