text stringlengths 213 7.14k | idx int64 16 12.5k |
|---|---|
--- initial
+++ final
@@ -1,12 +1,9 @@
static int bq24257_irq_probe(struct bq24257_device *bq) {
- int ret;
struct gpio_desc *stat_irq;
- stat_irq = devm_gpiod_get_index(bq->dev, BQ24257_STAT_IRQ, 0);
+ stat_irq = devm_gpiod_get_index(bq->dev, BQ24257_STAT_IRQ, 0, GPIOD_IN);
if (IS_ERR(stat_irq)) {
dev_e... | 282 |
--- initial
+++ final
@@ -1,8 +1,8 @@
static int bq24257_pg_gpio_probe(struct bq24257_device *bq) {
- bq->pg = devm_gpiod_get_index(bq->dev, BQ24257_PG_GPIO, 0);
+ bq->pg = devm_gpiod_get_index(bq->dev, BQ24257_PG_GPIO, 0, GPIOD_IN);
if (IS_ERR(bq->pg)) {
dev_err(bq->dev, "could not probe PG pin\n");
re... | 283 |
--- initial
+++ final
@@ -1,30 +1,20 @@
static int edp_gpio_config(struct edp_ctrl *ctrl) {
struct device *dev = &ctrl->pdev->dev;
int ret;
- ctrl->panel_hpd_gpio = devm_gpiod_get(dev, "panel-hpd");
+ ctrl->panel_hpd_gpio = devm_gpiod_get(dev, "panel-hpd", GPIOD_IN);
if (IS_ERR(ctrl->panel_hpd_gpio)) {
... | 284 |
--- initial
+++ final
@@ -1,84 +1,82 @@
static int mxs_lradc_probe(struct platform_device *pdev) {
const struct of_device_id *of_id = of_match_device(mxs_lradc_dt_ids, &pdev->dev);
const struct mxs_lradc_of_config *of_cfg = &mxs_lradc_of_config[(enum mxs_lradc_id)of_id->data];
struct device *dev = &pdev->dev;... | 285 |
--- initial
+++ final
@@ -1,87 +1,83 @@
static int spear_adc_probe(struct platform_device *pdev) {
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct spear_adc_info *info;
struct iio_dev *iodev = NULL;
int ret = -ENODEV;
int irq;
- iodev = iio_device_alloc(sizeof(str... | 286 |
--- initial
+++ final
@@ -1,88 +1,86 @@
static int exynos_adc_probe(struct platform_device *pdev) {
struct exynos_adc *info = NULL;
struct device_node *np = pdev->dev.of_node;
struct iio_dev *indio_dev = NULL;
struct resource *mem;
int ret = -ENODEV;
int irq;
if (!np) return ret;
- indio_dev = ii... | 287 |
--- initial
+++ final
@@ -1,141 +1,135 @@
static int at91_adc_probe(struct platform_device *pdev) {
unsigned int prsc, mstrclk, ticks, adc_clk, shtim;
int ret;
struct iio_dev *idev;
struct at91_adc_state *st;
struct resource *res;
u32 reg;
- idev = iio_device_alloc(sizeof(struct at91_adc_state));
- ... | 288 |
--- initial
+++ final
@@ -1,30 +1,24 @@
static int kxsd9_probe(struct spi_device *spi) {
struct iio_dev *indio_dev;
struct kxsd9_state *st;
int ret;
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto error_ret;
- }
+ indio_dev = devm_iio_device_alloc(dev,... | 289 |
--- initial
+++ final
@@ -1,76 +1,70 @@
static int hid_accel_3d_probe(struct platform_device *pdev) {
int ret = 0;
static const char *name = "accel_3d";
struct iio_dev *indio_dev;
struct accel_3d_state *accel_state;
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
struct iio_chan_spec *... | 290 |
--- initial
+++ final
@@ -1,20 +1,14 @@
static int st_accel_spi_probe(struct spi_device *spi) {
struct iio_dev *indio_dev;
struct st_sensor_data *adata;
int err;
- indio_dev = iio_device_alloc(sizeof(*adata));
- if (indio_dev == NULL) {
- err = -ENOMEM;
- goto iio_device_alloc_error;
- }
+ indio_dev... | 291 |
--- initial
+++ final
@@ -1,44 +1,40 @@
static int tiadc_probe(struct platform_device *pdev) {
struct iio_dev *indio_dev;
struct tiadc_device *adc_dev;
struct device_node *node = pdev->dev.of_node;
struct property *prop;
const __be32 *cur;
int err;
u32 val;
int channels = 0;
if (!node) {
... | 292 |
--- initial
+++ final
@@ -1,30 +1,28 @@
static int vprbrd_adc_probe(struct platform_device *pdev) {
struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent);
struct vprbrd_adc *adc;
struct iio_dev *indio_dev;
int ret;
/* registering iio */
- indio_dev = iio_device_alloc(sizeof(*adc));
+ indio_dev = devm_... | 293 |
--- initial
+++ final
@@ -1,20 +1,14 @@
static int st_press_spi_probe(struct spi_device *spi) {
struct iio_dev *indio_dev;
struct st_sensor_data *pdata;
int err;
- indio_dev = iio_device_alloc(sizeof(*pdata));
- if (indio_dev == NULL) {
- err = -ENOMEM;
- goto iio_device_alloc_error;
- }
+ indio_dev... | 294 |
--- initial
+++ final
@@ -1,34 +1,32 @@
static int adis16480_probe(struct spi_device *spi) {
const struct spi_device_id *id = spi_get_device_id(spi);
struct iio_dev *indio_dev;
struct adis16480 *st;
int ret;
- indio_dev = iio_device_alloc(sizeof(*st));
+ indio_dev = devm_iio_device_alloc(&spi->dev, sizeo... | 295 |
--- initial
+++ final
@@ -1,76 +1,70 @@
static int hid_als_probe(struct platform_device *pdev) {
int ret = 0;
static const char *name = "als";
struct iio_dev *indio_dev;
struct als_state *als_state;
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
struct iio_chan_spec *channels;
- indi... | 296 |
--- initial
+++ final
@@ -1,35 +1,33 @@
static int adis16400_probe(struct spi_device *spi) {
struct adis16400_state *st;
struct iio_dev *indio_dev;
int ret;
- indio_dev = iio_device_alloc(sizeof(*st));
+ indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
if (indio_dev == NULL) return -ENOMEM;
... | 297 |
--- initial
+++ final
@@ -1,20 +1,14 @@
static int st_magn_spi_probe(struct spi_device *spi) {
struct iio_dev *indio_dev;
struct st_sensor_data *mdata;
int err;
- indio_dev = iio_device_alloc(sizeof(*mdata));
- if (indio_dev == NULL) {
- err = -ENOMEM;
- goto iio_device_alloc_error;
- }
+ indio_dev ... | 298 |
--- initial
+++ final
@@ -1,76 +1,70 @@
static int hid_magn_3d_probe(struct platform_device *pdev) {
int ret = 0;
static char *name = "magn_3d";
struct iio_dev *indio_dev;
struct magn_3d_state *magn_state;
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
struct iio_chan_spec *channels;
... | 299 |
--- initial
+++ final
@@ -1,76 +1,70 @@
static int hid_gyro_3d_probe(struct platform_device *pdev) {
int ret = 0;
static const char *name = "gyro_3d";
struct iio_dev *indio_dev;
struct gyro_3d_state *gyro_state;
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
struct iio_chan_spec *chan... | 300 |
--- initial
+++ final
@@ -1,30 +1,24 @@
static int adis16060_r_probe(struct spi_device *spi) {
int ret;
struct adis16060_state *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;... | 301 |
--- initial
+++ final
@@ -1,29 +1,23 @@
static int adis16130_probe(struct spi_device *spi) {
int ret;
struct adis16130_state *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
-... | 302 |
--- initial
+++ final
@@ -1,34 +1,28 @@
static int adxrs450_probe(struct spi_device *spi) {
int ret;
struct adxrs450_state *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- ... | 303 |
--- initial
+++ final
@@ -1,20 +1,14 @@
static int st_gyro_spi_probe(struct spi_device *spi) {
struct iio_dev *indio_dev;
struct st_sensor_data *gdata;
int err;
- indio_dev = iio_device_alloc(sizeof(*gdata));
- if (indio_dev == NULL) {
- err = -ENOMEM;
- goto iio_device_alloc_error;
- }
+ indio_dev ... | 304 |
--- initial
+++ final
@@ -1,36 +1,30 @@
static int adis16260_probe(struct spi_device *spi) {
struct iio_dev *indio_dev;
struct adis *adis;
int ret;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*adis));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- got... | 305 |
--- initial
+++ final
@@ -1,34 +1,32 @@
static int adis16136_probe(struct spi_device *spi) {
const struct spi_device_id *id = spi_get_device_id(spi);
struct adis16136 *adis16136;
struct iio_dev *indio_dev;
int ret;
- indio_dev = iio_device_alloc(sizeof(*adis16136));
+ indio_dev = devm_iio_device_alloc(&s... | 306 |
--- initial
+++ final
@@ -1,31 +1,25 @@
static int adis16080_probe(struct spi_device *spi) {
const struct spi_device_id *id = spi_get_device_id(spi);
int ret;
struct adis16080_state *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(siz... | 307 |
--- initial
+++ final
@@ -1,36 +1,34 @@
static int ad5755_probe(struct spi_device *spi) {
enum ad5755_type type = spi_get_device_id(spi)->driver_data;
const struct ad5755_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad5755_state *st;
int ret;
- indio_dev = iio_d... | 308 |
--- initial
+++ final
@@ -1,53 +1,47 @@
static int sca3000_probe(struct spi_device *spi) {
int ret;
struct sca3000_state *st;
struct iio_dev *indio_dev;
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto error_ret;
- }
+ indio_dev = devm_iio_device_alloc(... | 309 |
--- initial
+++ final
@@ -1,46 +1,40 @@
static int adis16220_probe(struct spi_device *spi) {
int ret;
struct adis16220_state *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
-... | 310 |
--- initial
+++ final
@@ -1,53 +1,47 @@
static int lis3l02dq_probe(struct spi_device *spi) {
int ret;
struct lis3l02dq_state *st;
struct iio_dev *indio_dev;
- indio_dev = iio_device_alloc(sizeof *st);
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto error_ret;
- }
+ indio_dev = devm_iio_device_all... | 311 |
--- initial
+++ final
@@ -1,36 +1,30 @@
static int adis16203_probe(struct spi_device *spi) {
int ret;
struct iio_dev *indio_dev;
struct adis *st;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto er... | 312 |
--- initial
+++ final
@@ -1,36 +1,30 @@
static int adis16209_probe(struct spi_device *spi) {
int ret;
struct adis *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto er... | 313 |
--- initial
+++ final
@@ -1,36 +1,30 @@
static int adis16204_probe(struct spi_device *spi) {
int ret;
struct adis *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto er... | 314 |
--- initial
+++ final
@@ -1,36 +1,30 @@
static int adis16240_probe(struct spi_device *spi) {
int ret;
struct adis *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto er... | 315 |
--- initial
+++ final
@@ -1,36 +1,30 @@
static int adis16201_probe(struct spi_device *spi) {
int ret;
struct adis *st;
struct iio_dev *indio_dev;
/* setup the industrialio driver allocated elements */
- indio_dev = iio_device_alloc(sizeof(*st));
- if (indio_dev == NULL) {
- ret = -ENOMEM;
- goto er... | 316 |
--- initial
+++ final
@@ -1,47 +1,45 @@
int au0828_dvb_register(struct au0828_dev *dev) {
struct au0828_dvb *dvb = &dev->dvb;
int ret;
dprintk(1, "%s()\n", __func__);
/* init frontend */
switch (dev->boardnr) {
case AU0828_BOARD_HAUPPAUGE_HVR850:
case AU0828_BOARD_HAUPPAUGE_HVR950Q:
dvb->fron... | 320 |
--- initial
+++ final
@@ -1,8 +1,7 @@
static inline void clocksource_start_watchdog(void) {
if (watchdog_running || !watchdog || list_empty(&watchdog_list)) return;
- init_timer(&watchdog_timer);
- watchdog_timer.function = clocksource_watchdog;
+ setup_timer(&watchdog_timer, clocksource_watchdog, 0UL);
watch... | 322 |
--- initial
+++ final
@@ -1,9 +1,7 @@
void fsm_settimer(fsm_instance *fi, fsm_timer *this) {
this->fi = fi;
- this->tl.function = (void *)fsm_expire_timer;
- this->tl.data = (long)this;
#if FSM_TIMER_DEBUG
printk(KERN_DEBUG "fsm(%s): Create timer %p\n", fi->name, this);
#endif
- init_timer(&this->tl);
+ se... | 330 |
--- initial
+++ final
@@ -1,61 +1,60 @@
static int __init isdn_init(void) {
int i;
char tmprev[50];
dev = vzalloc(sizeof(isdn_dev));
if (!dev) {
printk(KERN_WARNING "isdn: Could not allocate device-struct.\n");
return -EIO;
}
- init_timer(&dev->timer);
- dev->timer.function = isdn_timer_func... | 333 |
--- initial
+++ final
@@ -1,19 +1,18 @@
static int __init n2100_request_gpios(void) {
int ret;
if (!machine_is_n2100()) return 0;
ret = gpio_request(N2100_HARDWARE_RESET, "reset");
if (ret) pr_err("could not request reset GPIO\n");
ret = gpio_request(N2100_POWER_BUTTON, "power");
if (ret)
pr_err... | 337 |
--- initial
+++ final
@@ -1,11 +1,10 @@
static int __init init_nmi_wdt(void) {
nmi_wdt_set_timeout(timeout);
nmi_wdt_start();
nmi_active = true;
- init_timer(&ntimer);
- ntimer.function = nmi_wdt_timer;
+ setup_timer(&ntimer, nmi_wdt_timer, 0UL);
ntimer.expires = jiffies + NMI_CHECK_TIMEOUT;
add_time... | 341 |
--- initial
+++ final
@@ -1,6 +1,5 @@
static void init_battery_timer(void) {
- init_timer(&battery_timer);
- battery_timer.function = check_all_batteries;
+ setup_timer(&battery_timer, check_all_batteries, 0UL);
battery_timer.expires = jiffies + (HZ * 60);
add_timer(&battery_timer);
}<sep>@@
expression t,d,f... | 349 |
--- initial
+++ final
@@ -1,6 +1 @@
-static void fq_free(void *addr) {
- if (addr && is_vmalloc_addr(addr))
- vfree(addr);
- else
- kfree(addr);
-}
+static void fq_free(void *addr) { kvfree(addr); }<sep>@@
expression e;
@@
- if (e != NULL && is_vmalloc_addr(e))
- vfree(e);
- else
- ... | 474 |
--- initial
+++ final
@@ -1,29 +1,26 @@
static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) {
int i, s;
buddy->max_order = max_order;
spin_lock_init(&buddy->lock);
buddy->bits = kcalloc(buddy->max_order + 1, sizeof(long *), GFP_KERNEL);
buddy->num_free = kcalloc((buddy->max_order + 1), s... | 482 |
--- initial
+++ final
@@ -1,15 +1,12 @@
void nvdimm_drvdata_release(struct kref *kref) {
struct nvdimm_drvdata *ndd = container_of(kref, typeof(*ndd), kref);
struct device *dev = ndd->dev;
struct resource *res, *_r;
dev_dbg(dev, "%s\n", __func__);
nvdimm_bus_lock(dev);
for_each_dpa_resource_safe(ndd,... | 500 |
--- initial
+++ final
@@ -1,7 +1,7 @@
static int __init fid_init(void) {
int rc;
rc = libcfs_setup();
if (rc) return rc;
- seq_debugfs_dir = ldebugfs_register(LUSTRE_SEQ_NAME, debugfs_lustre_root, NULL, NULL);
- return PTR_ERR_OR_ZERO(seq_debugfs_dir);
+ seq_debugfs_dir = debugfs_create_dir(LUSTRE_SEQ_NAME... | 649 |
--- initial
+++ final
@@ -1,19 +1,13 @@
static int seq_client_debugfs_init(struct lu_client_seq *seq) {
int rc;
- seq->lcs_debugfs_entry = ldebugfs_register(seq->lcs_name, seq_debugfs_dir, NULL, NULL);
- if (IS_ERR_OR_NULL(seq->lcs_debugfs_entry)) {
- CERROR("%s: LdebugFS failed in seq-init\n", seq->lcs_name);... | 650 |
--- initial
+++ final
@@ -1,19 +1,13 @@
static int fld_client_debugfs_init(struct lu_client_fld *fld) {
int rc;
- fld->lcf_debugfs_entry = ldebugfs_register(fld->lcf_name, fld_debugfs_dir, NULL, NULL);
- if (IS_ERR_OR_NULL(fld->lcf_debugfs_entry)) {
- CERROR("%s: LdebugFS failed in fld-init\n", fld->lcf_name);... | 651 |
--- initial
+++ final
@@ -1,7 +1,7 @@
static int __init fld_init(void) {
int rc;
rc = libcfs_setup();
if (rc) return rc;
- fld_debugfs_dir = ldebugfs_register(LUSTRE_FLD_NAME, debugfs_lustre_root, NULL, NULL);
- return PTR_ERR_OR_ZERO(fld_debugfs_dir);
+ fld_debugfs_dir = debugfs_create_dir(LUSTRE_FLD_NAME... | 652 |
--- initial
+++ final
@@ -1,49 +1,44 @@
int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, const char *name, struct lu_device_type *ldt) {
struct obd_type *type;
int rc;
/* sanity check */
LASSERT(strnlen(name, CLASS_MAX_NAME) < CLASS_MAX_NAME);
if (class_search_type(name)) {
CD... | 653 |
--- initial
+++ final
@@ -1,46 +1,40 @@
static int ldlm_pool_debugfs_init(struct ldlm_pool *pl) {
struct ldlm_namespace *ns = container_of(pl, struct ldlm_namespace, ns_pool);
struct dentry *debugfs_ns_parent;
struct lprocfs_vars pool_vars[2];
char *var_name = NULL;
int rc = 0;
var_name = kzalloc(MAX... | 654 |
--- initial
+++ final
@@ -1,38 +1,23 @@
int ldlm_debugfs_setup(void) {
int rc;
- ldlm_debugfs_dir = ldebugfs_register(OBD_LDLM_DEVICENAME, debugfs_lustre_root, NULL, NULL);
- if (IS_ERR_OR_NULL(ldlm_debugfs_dir)) {
- CERROR("LProcFS failed in ldlm-init\n");
- rc = ldlm_debugfs_dir ? PTR_ERR(ldlm_debugfs_dir... | 655 |
--- initial
+++ final
@@ -1,45 +1,45 @@
int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) {
struct lprocfs_static_vars lvars = {NULL};
struct lov_desc *desc;
struct lov_obd *lov = &obd->u.lov;
int rc;
if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
CERROR("LOV setup requires a descriptor\n");
... | 656 |
--- initial
+++ final
@@ -1,76 +1,71 @@
int ldebugfs_register_mountpoint(struct dentry *parent, struct super_block *sb, char *osc, char *mdc) {
struct lustre_sb_info *lsi = s2lsi(sb);
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_device *obd;
struct dentry *dir;
char name[MAX_STRING_SIZE + 1], *ptr;... | 657 |
--- initial
+++ final
@@ -1,40 +1,35 @@
static void ptlrpc_ldebugfs_register(struct dentry *root, char *dir, char *name, struct dentry **debugfs_root_ret, struct lprocfs_stats **stats_ret) {
struct dentry *svc_debugfs_entry;
struct lprocfs_stats *svc_stats;
int i;
unsigned int svc_counter_config = LPROCFS_... | 658 |
--- initial
+++ final
@@ -1,36 +1,35 @@
static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data) {
int ret;
char *tmp;
DECLARE_WAITQUEUE(wait, current);
- tmp = kmalloc(1, GFP_KERNEL);
+ tmp = kmemdup(&data, 1, GFP_KERNEL);
if (!tmp) {
netif_warn(pegasus, drv, pegasus->net, "out of memory ... | 659 |
--- initial
+++ final
@@ -1,36 +1,35 @@
static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) {
int ret;
char *buffer;
DECLARE_WAITQUEUE(wait, current);
- buffer = kmalloc(size, GFP_KERNEL);
+ buffer = kmemdup(data, size, GFP_KERNEL);
if (!buffer) {
netif_warn(pegasus, drv... | 660 |
--- initial
+++ final
@@ -1,14 +1,13 @@
static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data) {
void *buf = NULL;
int err = -ENOMEM;
netdev_dbg(dev->net, "asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n", cmd, value, index, size);
if (data) {
- ... | 661 |
--- initial
+++ final
@@ -1,11 +1,10 @@
static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) {
struct usb_device *xdev = dev->udev;
int ret;
void *buffer;
- buffer = kmalloc(size, GFP_NOIO);
+ buffer = kmemdup(data, size, GFP_NOIO);
if (buffer == NULL) return -ENOMEM;
- ... | 662 |
--- initial
+++ final
@@ -1,15 +1,14 @@
static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data) {
void *buf = NULL;
int err = -ENOMEM;
netdev_dbg(dev->net, "dm_write() reg=0x%02x, length=%d\n", reg, length);
if (data) {
- buf = kmalloc(length, GFP_KERNEL);
+ buf = kmemdup(data, length... | 663 |
--- initial
+++ final
@@ -1,77 +1,76 @@
static void if_usb_receive_fwload(struct urb *urb) {
struct if_usb_card *cardp = urb->context;
struct sk_buff *skb = cardp->rx_skb;
struct fwsyncheader *syncfwheader;
struct bootcmdresp bootcmdresp;
if (urb->status) {
lbs_deb_usbd(&cardp->udev->dev, "URB stat... | 664 |
--- initial
+++ final
@@ -1,27 +1,26 @@
static int wl1251_fetch_nvs(struct wl1251 *wl) {
const struct firmware *fw;
struct device *dev = wiphy_dev(wl->hw->wiphy);
int ret;
ret = request_firmware(&fw, WL1251_NVS_NAME, dev);
if (ret < 0) {
wl1251_error("could not get nvs file: %d", ret);
return ... | 665 |
--- initial
+++ final
@@ -1,26 +1,25 @@
static int queue_dbg_open(struct inode *inode, struct file *file) {
struct usba_ep *ep = inode->i_private;
struct usba_request *req, *req_copy;
struct list_head *queue_data;
queue_data = kmalloc(sizeof(*queue_data), GFP_KERNEL);
if (!queue_data) return -ENOMEM;
... | 666 |
--- initial
+++ final
@@ -1,86 +1,85 @@
static void if_usb_receive_fwload(struct urb *urb) {
struct if_usb_card *cardp = urb->context;
struct sk_buff *skb = cardp->rx_skb;
struct fwsyncheader *syncfwheader;
struct bootcmdresp bcmdresp;
lbtf_deb_enter(LBTF_DEB_USB);
if (urb->status) {
lbtf_deb_us... | 667 |
--- initial
+++ final
@@ -1,59 +1,58 @@
int __init acpi_ec_ecdt_probe(void) {
acpi_status status;
struct acpi_ec *saved_ec = NULL;
struct acpi_table_ecdt *ecdt_ptr;
boot_ec = make_acpi_ec();
if (!boot_ec) return -ENOMEM;
/*
* Generate a boot ec context
*/
dmi_check_system(ec_dmi_table);
... | 668 |
--- initial
+++ final
@@ -1,83 +1,82 @@
struct ieee80211_hw *wl1271_alloc_hw(void) {
struct ieee80211_hw *hw;
struct platform_device *plat_dev = NULL;
struct wl1271 *wl;
int i, ret;
hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops);
if (!hw) {
wl1271_error("could not alloc ieee80211_hw");
r... | 669 |
--- initial
+++ final
@@ -1,17 +1,16 @@
static struct iwm_rx_ticket_node *iwm_rx_ticket_node_alloc(struct iwm_priv *iwm, struct iwm_rx_ticket *ticket) {
struct iwm_rx_ticket_node *ticket_node;
ticket_node = kzalloc(sizeof(struct iwm_rx_ticket_node), GFP_KERNEL);
if (!ticket_node) {
IWM_ERR(iwm, "Couldn't... | 670 |
--- initial
+++ final
@@ -1,11 +1,10 @@
static void ath9k_hif_usb_reboot(struct usb_device *udev) {
u32 reboot_cmd = 0xffffffff;
void *buf;
int ret;
- buf = kmalloc(4, GFP_KERNEL);
+ buf = kmemdup(&reboot_cmd, 4, GFP_KERNEL);
if (!buf) return;
- memcpy(buf, &reboot_cmd, 4);
ret = usb_bulk_msg(udev, u... | 671 |
--- initial
+++ final
@@ -1,64 +1,62 @@
int nouveau_grctx_prog_load(struct drm_device *dev) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
const int chipset = dev_priv->chipset;
const struct firmware *fw;
const struct nouveau_ct... | 672 |
--- initial
+++ final
@@ -1,20 +1,19 @@
static bool radeon_read_bios(struct radeon_device *rdev) {
uint8_t __iomem *bios;
size_t size;
rdev->bios = NULL;
/* XXX: some cards may return 0 for rom size? ddx has a workaround */
bios = pci_map_rom(rdev->pdev, &size);
if (!bios) { return false; }
if (si... | 673 |
--- initial
+++ final
@@ -1,65 +1,64 @@
static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id *id) {
const struct firmware *firmware;
struct usb_device *udev = interface_to_usbdev(intf);
struct bcm203x_data *data;
int size;
BT_DBG("intf %p id %p", intf, id);
if (intf->cur_al... | 675 |
--- initial
+++ final
@@ -1,47 +1,46 @@
int hid_parse_report(struct hid_device *device, __u8 *start, unsigned size) {
struct hid_parser *parser;
struct hid_item item;
__u8 *end;
int ret;
static int (*dispatch_type[])(struct hid_parser * parser, struct hid_item * item) = {hid_parser_main, hid_parser_glob... | 676 |
--- initial
+++ final
@@ -1,79 +1,78 @@
static int dma_tx_fragment(struct b43_dmaring *ring, struct sk_buff *skb) {
const struct b43_dma_ops *ops = ring->ops;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct b43_private_tx_info *priv_info = b43_get_priv_tx_info(info);
u8 *header;
int slot,... | 677 |
--- initial
+++ final
@@ -1,25 +1,24 @@
static int ipw_wx_set_genie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct ipw_priv *priv = libipw_priv(dev);
struct libipw_device *ieee = priv->ieee;
u8 *buf;
int err = 0;
if (wrqu->data.length > MAX_WPA_IE_LEN... | 678 |
--- initial
+++ final
@@ -1,41 +1,39 @@
int pohmelfs_copy_crypto(struct pohmelfs_sb *psb) {
struct pohmelfs_config_group *g;
int err = -ENOENT;
mutex_lock(&pohmelfs_config_lock);
g = pohmelfs_find_config_group(psb->idx);
if (!g) goto err_out_exit;
if (g->hash_string) {
err = -ENOMEM;
psb->h... | 679 |
--- initial
+++ final
@@ -1,16 +1,15 @@
static int pohmelfs_crypto_cipher_init(struct pohmelfs_config_group *g, struct pohmelfs_crypto *c) {
char *algo = (char *)c->data;
u8 *key = (u8 *)(algo + c->strlen);
if (g->cipher_string) return -EEXIST;
g->cipher_string = kstrdup(algo, GFP_KERNEL);
if (!g->ciphe... | 680 |
--- initial
+++ final
@@ -1,16 +1,15 @@
static int pohmelfs_crypto_hash_init(struct pohmelfs_config_group *g, struct pohmelfs_crypto *c) {
char *algo = (char *)c->data;
u8 *key = (u8 *)(algo + c->strlen);
if (g->hash_string) return -EEXIST;
g->hash_string = kstrdup(algo, GFP_KERNEL);
if (!g->hash_string... | 681 |
--- initial
+++ final
@@ -1,7 +1,6 @@
int line6_dumpreq_initbuf(struct line6_dump_request *l6dr, const void *buf, size_t len, int num) {
- l6dr->reqbufs[num].buffer = kmalloc(len, GFP_KERNEL);
+ l6dr->reqbufs[num].buffer = kmemdup(buf, len, GFP_KERNEL);
if (l6dr->reqbufs[num].buffer == NULL) return -ENOMEM;
- me... | 682 |
--- initial
+++ final
@@ -1,18 +1,17 @@
static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, struct ieee_param *param, int plen) {
u8 *buf;
if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) return -EINVAL;
if (param->u.wpa_ie.len) {
- buf = kma... | 683 |
--- initial
+++ final
@@ -1,24 +1,23 @@
int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) {
u8 *buf;
if (len > MAX_WPA_IE_LEN || (len && ie == NULL)) {
// printk("return error out, len:%d\n", len);
return -EINVAL;
}
if (len) {
if (len != ie[1] + 2) {
print... | 684 |
--- initial
+++ final
@@ -1,20 +1,19 @@
static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) {
struct ieee80211_authentication *a;
u8 *t;
if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) {
IEEE80211_DEBUG_MGMT("invalid len in auth ... | 685 |
--- initial
+++ final
@@ -1,18 +1,17 @@
static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, struct ieee_param *param, int plen) {
u8 *buf;
if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) return -EINVAL;
if (param->u.wpa_ie.len) {
- buf = kma... | 686 |
--- initial
+++ final
@@ -1,24 +1,23 @@
int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) {
u8 *buf;
if (len > MAX_WPA_IE_LEN || (len && ie == NULL)) {
// printk("return error out, len:%d\n", len);
return -EINVAL;
}
if (len) {
if (len != ie[1] + 2) {
print... | 687 |
--- initial
+++ final
@@ -1,65 +1,64 @@
int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod) {
int err;
struct usb_line6 *line6 = &pod->line6;
if ((interface == NULL) || (pod == NULL)) return -ENODEV;
pod->channel_num = 255;
/* initialize wait queues: */
init_waitqueue_head(&pod->... | 688 |
--- initial
+++ final
@@ -1,18 +1,17 @@
static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, struct ieee_param *param, int plen) {
u8 *buf;
if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) return -EINVAL;
if (param->u.wpa_ie.len) {
- buf = kma... | 689 |
--- initial
+++ final
@@ -1,25 +1,24 @@
int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) {
u8 *buf = NULL;
if (len > MAX_WPA_IE_LEN || (len && ie == NULL)) {
printk("return error out, len:%zu\n", len);
return -EINVAL;
}
if (len) {
if (len != ie[1] + 2) {
... | 690 |
--- initial
+++ final
@@ -1,18 +1,17 @@
static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, struct ieee_param *param, int plen) {
u8 *buf;
if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) return -EINVAL;
if (param->u.wpa_ie.len) {
- buf = kma... | 691 |
--- initial
+++ final
@@ -1,35 +1,34 @@
int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
#if 0
printk("====>%s()\n", __FUNCTION__);
{
int i;
for (i=0; i<len; i++)
printk("%2x ", ie[i]&0xff);
printk("\n");
}
#endif
... | 692 |
--- initial
+++ final
@@ -1,62 +1,61 @@
static void stub_recv_cmd_submit(struct stub_device *sdev, struct usbip_header *pdu) {
int ret;
struct stub_priv *priv;
struct usbip_device *ud = &sdev->ud;
struct usb_device *udev = interface_to_usbdev(sdev->interface);
int pipe = get_pipe(sdev, pdu->base.ep, pdu... | 693 |
--- initial
+++ final
@@ -1,36 +1,35 @@
static int firmwareUpload(struct usbduxsub *usbduxsub, const u8 *firmwareBinary, int sizeFirmware) {
int ret;
uint8_t *fwBuf;
if (!firmwareBinary) return 0;
if (sizeFirmware > FIRMWARE_MAX_LEN) {
dev_err(&usbduxsub->interface->dev, "usbdux firmware binary it too... | 694 |
--- initial
+++ final
@@ -1,36 +1,35 @@
static int firmwareUpload(struct usbduxfastsub_s *usbduxfastsub, const u8 *firmwareBinary, int sizeFirmware) {
int ret;
uint8_t *fwBuf;
if (!firmwareBinary) return 0;
if (sizeFirmware > FIRMWARE_MAX_LEN) {
dev_err(&usbduxfastsub->interface->dev, "comedi_: usbdux... | 695 |
--- initial
+++ final
@@ -1,63 +1,62 @@
int variax_init(struct usb_interface *interface, struct usb_line6_variax *variax) {
int err;
if ((interface == NULL) || (variax == NULL)) return -ENODEV;
/* initialize USB buffers: */
err = line6_dumpreq_init(&variax->dumpreq, variax_request_model1, sizeof(variax_req... | 696 |
--- initial
+++ final
@@ -1,34 +1,33 @@
static void VmbusOnMsgDPC(struct hv_driver *drv) {
int cpu = smp_processor_id();
void *page_addr = gHvContext.synICMessagePage[cpu];
struct hv_message *msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
struct hv_message *copied;
while (1) {
if (msg->... | 697 |
--- initial
+++ final
@@ -1,39 +1,38 @@
static __init acpi_status parse_wdg(acpi_handle handle) {
struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
union acpi_object *obj;
struct guid_block *gblock;
struct wmi_block *wblock;
char guid_string[37];
acpi_status status;
u32 i, total;
status = ... | 698 |
--- initial
+++ final
@@ -1,17 +1,16 @@
int rdma_set_ib_paths(struct rdma_cm_id *id, struct ib_sa_path_rec *path_rec, int num_paths) {
struct rdma_id_private *id_priv;
int ret;
id_priv = container_of(id, struct rdma_id_private, id);
if (!cma_comp_exch(id_priv, CMA_ADDR_RESOLVED, CMA_ROUTE_RESOLVED)) return... | 699 |
--- initial
+++ final
@@ -1,147 +1,145 @@
struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, u8 port_num, enum ib_qp_type qp_type, struct ib_mad_reg_req *mad_reg_req, u8 rmpp_version, ib_mad_send_handler send_handler, ib_mad_recv_handler recv_handler, void *context) {
struct ib_mad_port_private *p... | 700 |
--- initial
+++ final
@@ -1,130 +1,129 @@
int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) {
struct p54_common *priv = dev->priv;
struct eeprom_pda_wrap *wrap;
struct pda_entry *entry;
unsigned int data_len, entry_len;
void *tmp;
int err;
u8 *end = (u8 *)eeprom + len;
u16 s... | 701 |
--- initial
+++ final
@@ -1,16 +1,15 @@
static int p54u_firmware_reset_3887(struct ieee80211_hw *dev) {
struct p54u_priv *priv = dev->priv;
u8 *buf;
int ret;
- buf = kmalloc(4, GFP_KERNEL);
+ buf = kmemdup(p54u_romboot_3887, 4, GFP_KERNEL);
if (!buf) return -ENOMEM;
- memcpy(buf, p54u_romboot_3887, 4);
... | 702 |
--- initial
+++ final
@@ -1,57 +1,56 @@
static int concat_writev(struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen) {
struct mtd_concat *concat = CONCAT(mtd);
struct kvec *vecs_copy;
unsigned long entry_low, entry_high;
size_t total_len = 0;
int i;
int err ... | 703 |
--- initial
+++ final
@@ -1,29 +1,28 @@
static int orinoco_ioctl_set_genie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct orinoco_private *priv = ndev_priv(dev);
u8 *buf;
unsigned long flags;
/* cut off at IEEE80211_MAX_DATA_LEN */
if ((wrqu->data.len... | 704 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.