Skip to content

Commit

Permalink
Merge tag 'staging-3.4-rc2' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/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
  • Loading branch information
torvalds committed Apr 12, 2012
2 parents f5ad501 + 474a898 commit 3dbc35a
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 57 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6471,6 +6471,7 @@ S: Odd Fixes
F: drivers/staging/olpc_dcon/

STAGING - OZMO DEVICES USB OVER WIFI DRIVER
M: Rupesh Gujare <[email protected]>
M: Chris Kelly <[email protected]>
S: Maintained
F: drivers/staging/ozwpan/
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/android/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ config ANDROID_LOGGER

config ANDROID_PERSISTENT_RAM
bool
depends on HAVE_MEMBLOCK
select REED_SOLOMON
select REED_SOLOMON_ENC8
select REED_SOLOMON_DEC8

config ANDROID_RAM_CONSOLE
bool "Android RAM buffer console"
depends on !S390 && !UML
depends on !S390 && !UML && HAVE_MEMBLOCK
select ANDROID_PERSISTENT_RAM
default n

Expand Down
11 changes: 7 additions & 4 deletions drivers/staging/android/persistent_ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,26 +399,26 @@ static __init
struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc)
{
struct persistent_ram_zone *prz;
int ret;
int ret = -ENOMEM;

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

INIT_LIST_HEAD(&prz->node);

ret = persistent_ram_buffer_init(dev_name(dev), prz);
if (ret) {
pr_err("persistent_ram: failed to initialize buffer\n");
return ERR_PTR(ret);
goto err;
}

prz->ecc = ecc;
ret = persistent_ram_init_ecc(prz, prz->buffer_size);
if (ret)
return ERR_PTR(ret);
goto err;

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

return prz;
err:
kfree(prz);
return ERR_PTR(ret);
}

struct persistent_ram_zone * __init
Expand Down
27 changes: 15 additions & 12 deletions drivers/staging/android/timed_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int timed_gpio_probe(struct platform_device *pdev)
struct timed_gpio_platform_data *pdata = pdev->dev.platform_data;
struct timed_gpio *cur_gpio;
struct timed_gpio_data *gpio_data, *gpio_dat;
int i, j, ret = 0;
int i, ret;

if (!pdata)
return -EBUSY;
Expand All @@ -108,18 +108,12 @@ static int timed_gpio_probe(struct platform_device *pdev)
gpio_dat->dev.get_time = gpio_get_time;
gpio_dat->dev.enable = gpio_enable;
ret = gpio_request(cur_gpio->gpio, cur_gpio->name);
if (ret >= 0) {
ret = timed_output_dev_register(&gpio_dat->dev);
if (ret < 0)
gpio_free(cur_gpio->gpio);
}
if (ret < 0)
goto err_out;
ret = timed_output_dev_register(&gpio_dat->dev);
if (ret < 0) {
for (j = 0; j < i; j++) {
timed_output_dev_unregister(&gpio_data[i].dev);
gpio_free(gpio_data[i].gpio);
}
kfree(gpio_data);
return ret;
gpio_free(cur_gpio->gpio);
goto err_out;
}

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

return 0;

err_out:
while (--i >= 0) {
timed_output_dev_unregister(&gpio_data[i].dev);
gpio_free(gpio_data[i].gpio);
}
kfree(gpio_data);

return ret;
}

static int timed_gpio_remove(struct platform_device *pdev)
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/iio/inkern.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ int iio_map_array_unregister(struct iio_dev *indio_dev,
ret = -ENODEV;
goto error_ret;
}
i++;
}
error_ret:
mutex_unlock(&iio_map_list_lock);
Expand Down
8 changes: 5 additions & 3 deletions drivers/staging/iio/magnetometer/ak8975.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ static const int ak8975_index_to_reg[] = {
static int ak8975_write_data(struct i2c_client *client,
u8 reg, u8 val, u8 mask, u8 shift)
{
struct ak8975_data *data = i2c_get_clientdata(client);
struct iio_dev *indio_dev = i2c_get_clientdata(client);
struct ak8975_data *data = iio_priv(indio_dev);
u8 regval;
int ret;

Expand Down Expand Up @@ -159,7 +160,8 @@ static int ak8975_read_data(struct i2c_client *client,
*/
static int ak8975_setup(struct i2c_client *client)
{
struct ak8975_data *data = i2c_get_clientdata(client);
struct iio_dev *indio_dev = i2c_get_clientdata(client);
struct ak8975_data *data = iio_priv(indio_dev);
u8 device_id;
int ret;

Expand Down Expand Up @@ -509,14 +511,14 @@ static int ak8975_probe(struct i2c_client *client,
goto exit_gpio;
}
data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
/* Perform some basic start-of-day setup of the device. */
err = ak8975_setup(client);
if (err < 0) {
dev_err(&client->dev, "AK8975 initialization fails\n");
goto exit_free_iio;
}

i2c_set_clientdata(client, indio_dev);
data->client = client;
mutex_init(&data->lock);
data->eoc_irq = client->irq;
Expand Down
4 changes: 3 additions & 1 deletion drivers/staging/iio/magnetometer/hmc5843.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ static int hmc5843_detect(struct i2c_client *client,
/* Called when we have found a new HMC5843. */
static void hmc5843_init_client(struct i2c_client *client)
{
struct hmc5843_data *data = i2c_get_clientdata(client);
struct iio_dev *indio_dev = i2c_get_clientdata(client);
struct hmc5843_data *data = iio_priv(indio_dev);

hmc5843_set_meas_conf(client, data->meas_conf);
hmc5843_set_rate(client, data->rate);
hmc5843_configure(client, data->operating_mode);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/media/as102/as102_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static int as102_firmware_upload(struct as10x_bus_adapter_t *bus_adap,
int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap)
{
int errno = -EFAULT;
const struct firmware *firmware;
const struct firmware *firmware = NULL;
unsigned char *cmd_buf = NULL;
char *fw1, *fw2;
struct usb_device *dev = bus_adap->usb_dev;
Expand Down
7 changes: 4 additions & 3 deletions drivers/staging/omapdrm/omap_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,6 @@ static void pdev_shutdown(struct platform_device *device)
static int pdev_probe(struct platform_device *device)
{
DBG("%s", device->name);
if (platform_driver_register(&omap_dmm_driver))
dev_err(&device->dev, "DMM registration failed\n");

return drm_platform_init(&omap_drm_driver, device);
}

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

Expand Down
4 changes: 3 additions & 1 deletion drivers/staging/ozwpan/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ TODO:
- code review by USB developer community.
- testing with as many devices as possible.

Please send any patches for this driver to Chris Kelly <[email protected]>
Please send any patches for this driver to
Rupesh Gujare <[email protected]>
Chris Kelly <[email protected]>
and Greg Kroah-Hartman <[email protected]>.
6 changes: 1 addition & 5 deletions drivers/staging/ramster/Kconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Dependency on CONFIG_BROKEN is because there is a commit dependency
# on a cleancache naming change to be submitted by Konrad Wilk
# a39c00ded70339603ffe1b0ffdf3ade85bcf009a "Merge branch 'stable/cleancache.v13'
# into linux-next. Once this commit is present, BROKEN can be removed
config RAMSTER
bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem"
depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM && BROKEN
depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM
select LZO_COMPRESS
select LZO_DECOMPRESS
default n
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/rts_pstor/ms.c
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32

log_blk++;

for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) {
for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1;
seg_no++) {
if (log_blk < ms_start_idx[seg_no+1])
break;
}
Expand Down
5 changes: 5 additions & 0 deletions drivers/staging/rts_pstor/rtsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,11 @@ static int __devinit rtsx_probe(struct pci_dev *pci,

rtsx_init_chip(dev->chip);

/* set the supported max_lun and max_id for the scsi host
* NOTE: the minimal value of max_id is 1 */
host->max_id = 1;
host->max_lun = dev->chip->max_lun;

/* Start up our control thread */
th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME);
if (IS_ERR(th)) {
Expand Down
11 changes: 6 additions & 5 deletions drivers/staging/rts_pstor/rtsx_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
int sg_cnt, i, resid;
int err = 0;
long timeleft;
struct scatterlist *sg_ptr;
u32 val = TRIG_DMA;

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

resid = size;

sg_ptr = sg;
chip->sgi = 0;
/* Usually the next entry will be @sg@ + 1, but if this sg element
* is part of a chained scatterlist, it could jump to the start of
* a new scatterlist array. So here we use sg_next to move to
* the proper sg
*/
for (i = 0; i < *index; i++)
sg = sg_next(sg);
sg_ptr = sg_next(sg_ptr);
for (i = *index; i < sg_cnt; i++) {
dma_addr_t addr;
unsigned int len;
u8 option;

addr = sg_dma_address(sg);
len = sg_dma_len(sg);
addr = sg_dma_address(sg_ptr);
len = sg_dma_len(sg_ptr);

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

sg = sg_next(sg);
sg_ptr = sg_next(sg_ptr);
}

RTSX_DEBUGP("SG table count = %d\n", chip->sgi);
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/sep/sep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3114,17 +3114,17 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
current->pid);
if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET,
&call_status->status)) {
dev_warn(&sep->pdev->dev,
dev_dbg(&sep->pdev->dev,
"[PID%d] dcb prep needed before send msg\n",
current->pid);
error = -EPROTO;
goto end_function;
}

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

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/vme/devices/vme_pio2_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ static int vector[PIO2_CARDS_MAX];
static int vector_num;
static int level[PIO2_CARDS_MAX];
static int level_num;
static const char *variant[PIO2_CARDS_MAX];
static char *variant[PIO2_CARDS_MAX];
static int variant_num;

static int loopback;
static bool loopback;

static int pio2_match(struct vme_dev *);
static int __devinit pio2_probe(struct vme_dev *);
Expand Down
3 changes: 3 additions & 0 deletions drivers/staging/vt6655/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ bool KeybSetDefaultKey (
return (false);
}

if (uKeyLength > MAX_KEY_LEN)
return false;

pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true;
for(ii=0;ii<ETH_ALEN;ii++)
pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/vt6656/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
result = -ENOMEM;
break;
}
pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC);
pNodeList = kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC);
if (pNodeList == NULL) {
result = -ENOMEM;
break;
Expand Down Expand Up @@ -601,6 +601,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
}
}
if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) {
kfree(pNodeList);
result = -EFAULT;
break;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/staging/vt6656/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ BOOL KeybSetDefaultKey(
return (FALSE);
}

if (uKeyLength > MAX_KEY_LEN)
return false;

pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE;
for (ii = 0; ii < ETH_ALEN; ii++)
pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/xgifb/vb_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension,
}
temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
/* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */
if ((temp & 0x88) == 0x80)
if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08))
data = 0; /* DDR */
else
data = 1; /* DDRII */
Expand Down
7 changes: 7 additions & 0 deletions drivers/staging/xgifb/vb_setmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
pVBInfo->pXGINew_CR97 = &XG20_CR97;

if (ChipType == XG27) {
unsigned char temp;
pVBInfo->MCLKData
= (struct SiS_MCLKData *) XGI27New_MCLKData;
pVBInfo->CR40 = XGI27_cr41;
Expand All @@ -162,7 +163,13 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
pVBInfo->pCRDE = XG27_CRDE;
pVBInfo->pSR40 = &XG27_SR40;
pVBInfo->pSR41 = &XG27_SR41;
pVBInfo->SR15 = XG27_SR13;

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

if (ChipType >= XG20) {
Expand Down
Loading

0 comments on commit 3dbc35a

Please sign in to comment.