Commit 3dbc35a3 authored by Linus Torvalds's avatar Linus Torvalds

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 <gregkh@linuxfoundation.org>"

* 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
parents f5ad5010 474a8988
......@@ -6471,6 +6471,7 @@ S: Odd Fixes
F: drivers/staging/olpc_dcon/
STAGING - OZMO DEVICES USB OVER WIFI DRIVER
M: Rupesh Gujare <rgujare@ozmodevices.com>
M: Chris Kelly <ckelly@ozmodevices.com>
S: Maintained
F: drivers/staging/ozwpan/
......
......@@ -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
......
......@@ -399,12 +399,12 @@ 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);
......@@ -412,13 +412,13 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc)
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 ||
......@@ -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
......
......@@ -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;
......@@ -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;
......@@ -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)
......
......@@ -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);
......
......@@ -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;
......@@ -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;
......@@ -509,6 +511,7 @@ 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) {
......@@ -516,7 +519,6 @@ static int ak8975_probe(struct i2c_client *client,
goto exit_free_iio;
}
i2c_set_clientdata(client, indio_dev);
data->client = client;
mutex_init(&data->lock);
data->eoc_irq = client->irq;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
}
......@@ -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);
}
......
......@@ -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 <ckelly@ozmodevices.com>
Please send any patches for this driver to
Rupesh Gujare <rgujare@ozmodevices.com>
Chris Kelly <ckelly@ozmodevices.com>
and Greg Kroah-Hartman <gregkh@linuxfoundation.org>.
# 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
......
......@@ -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;
}
......
......@@ -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)) {
......
......@@ -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)
......@@ -371,7 +372,7 @@ 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
......@@ -379,14 +380,14 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
* 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);
......@@ -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);
......
......@@ -3114,7 +3114,7 @@ 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;
......@@ -3122,9 +3122,9 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
}
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;
}
......
......@@ -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 *);
......
......@@ -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;
......
......@@ -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;
......@@ -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;
}
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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;
......@@ -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) {
......
......@@ -33,6 +33,13 @@ static struct XGI_ECLKDataStruct XGI340_ECLKData[] = {
{0x5c, 0x23, 0x01, 166}
};
static unsigned char XG27_SR13[4][8] = {
{0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */
{0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */
{0x32, 0x32, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR18 */
{0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00} /* SR1B */
};
static unsigned char XGI340_SR13[4][8] = {
{0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */
{0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */
......@@ -71,7 +78,7 @@ static unsigned char XGI27_cr41[24][8] = {
{0x20, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0 CR41 */
{0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 1 CR8A */
{0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 2 CR8B */
{0xB5, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7],
{0xB3, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7],
CR99[2:0],
CR45[3:0]*/
{0xf0, 0xf5, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 4 CR59 */
......@@ -2803,6 +2810,8 @@ static unsigned char XG27_CRDE[2];
static unsigned char XG27_SR40 = 0x04 ;
static unsigned char XG27_SR41 = 0x00 ;
static unsigned char Z11m_CR97 = 0x80 ;
static struct XGI330_VCLKDataStruct XGI_VCLKData[] = {
/* SR2B,SR2C,SR2D */
{0x1B, 0xE1, 25}, /* 00 (25.175MHz) */
......
......@@ -267,33 +267,39 @@ static unsigned long obj_idx_to_offset(struct page *page,
return off + obj_idx * class_size;
}
static void reset_page(struct page *page)
{
clear_bit(PG_private, &page->flags);
clear_bit(PG_private_2, &page->flags);
set_page_private(page, 0);
page->mapping = NULL;
page->freelist = NULL;
reset_page_mapcount(page);
}
static void free_zspage(struct page *first_page)
{
struct page *nextp, *tmp;
struct page *nextp, *tmp, *head_extra;
BUG_ON(!is_first_page(first_page));
BUG_ON(first_page->inuse);
nextp = (struct page *)page_private(first_page);
head_extra = (struct page *)page_private(first_page);
clear_bit(PG_private, &first_page->flags);
clear_bit(PG_private_2, &first_page->flags);
set_page_private(first_page, 0);
first_page->mapping = NULL;
first_page->freelist = NULL;
reset_page_mapcount(first_page);
reset_page(first_page);
__free_page(first_page);
/* zspage with only 1 system page */
if (!nextp)
if (!head_extra)
return;
list_for_each_entry_safe(nextp, tmp, &nextp->lru, lru) {
list_for_each_entry_safe(nextp, tmp, &head_extra->lru, lru) {
list_del(&nextp->lru);
clear_bit(PG_private_2, &nextp->flags);
nextp->index = 0;
reset_page(nextp);
__free_page(nextp);
}
reset_page(head_extra);
__free_page(head_extra);
}
/* Initialize a newly allocated zspage */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment