text
stringlengths
213
7.14k
idx
int64
16
12.5k
--- initial +++ final @@ -1,44 +1,42 @@ struct kbd_data *kbd_alloc(void) { struct kbd_data *kbd; int i; kbd = kzalloc(sizeof(struct kbd_data), GFP_KERNEL); if (!kbd) goto out; kbd->key_maps = kzalloc(sizeof(key_maps), GFP_KERNEL); if (!kbd->key_maps) goto out_kbd; for (i = 0; i < ARRAY_SIZE(key_maps); i++) { if (key_maps[i]) { - kbd->key_maps[i] = kmalloc(sizeof(u_short) * NR_KEYS, GFP_KERNEL); + kbd->key_maps[i] = kmemdup(key_maps[i], sizeof(u_short) * NR_KEYS, GFP_KERNEL); if (!kbd->key_maps[i]) goto out_maps; - memcpy(kbd->key_maps[i], key_maps[i], sizeof(u_short) * NR_KEYS); } } kbd->func_table = kzalloc(sizeof(func_table), GFP_KERNEL); if (!kbd->func_table) goto out_maps; for (i = 0; i < ARRAY_SIZE(func_table); i++) { if (func_table[i]) { kbd->func_table[i] = kstrdup(func_table[i], GFP_KERNEL); if (!kbd->func_table[i]) goto out_func; } } kbd->fn_handler = kzalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL); if (!kbd->fn_handler) goto out_func; - kbd->accent_table = kmalloc(sizeof(struct kbdiacruc) * MAX_DIACR, GFP_KERNEL); + kbd->accent_table = kmemdup(accent_table, sizeof(struct kbdiacruc) * MAX_DIACR, GFP_KERNEL); if (!kbd->accent_table) goto out_fn_handler; - memcpy(kbd->accent_table, accent_table, sizeof(struct kbdiacruc) * MAX_DIACR); kbd->accent_table_size = accent_table_size; return kbd; out_fn_handler: kfree(kbd->fn_handler); out_func: for (i = 0; i < ARRAY_SIZE(func_table); i++) kfree(kbd->func_table[i]); kfree(kbd->func_table); out_maps: for (i = 0; i < ARRAY_SIZE(key_maps); i++) kfree(kbd->key_maps[i]); kfree(kbd->key_maps); out_kbd: kfree(kbd); out: return NULL; }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
705
--- initial +++ final @@ -1,67 +1,66 @@ static int nexio_init(struct usbtouch_usb *usbtouch) { struct usb_device *dev = interface_to_usbdev(usbtouch->interface); struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; struct nexio_priv *priv; int ret = -ENOMEM; int actual_len, i; unsigned char *buf; char *firmware_ver = NULL, *device_name = NULL; int input_ep = 0, output_ep = 0; /* find first input and output endpoint */ for (i = 0; i < interface->desc.bNumEndpoints; i++) { if (!input_ep && usb_endpoint_dir_in(&interface->endpoint[i].desc)) input_ep = interface->endpoint[i].desc.bEndpointAddress; if (!output_ep && usb_endpoint_dir_out(&interface->endpoint[i].desc)) output_ep = interface->endpoint[i].desc.bEndpointAddress; } if (!input_ep || !output_ep) return -ENXIO; buf = kmalloc(NEXIO_BUFSIZE, GFP_KERNEL); if (!buf) goto out_buf; /* two empty reads */ for (i = 0; i < 2; i++) { ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep), buf, NEXIO_BUFSIZE, &actual_len, NEXIO_TIMEOUT); if (ret < 0) goto out_buf; } /* send init command */ memcpy(buf, nexio_init_pkt, sizeof(nexio_init_pkt)); ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, output_ep), buf, sizeof(nexio_init_pkt), &actual_len, NEXIO_TIMEOUT); if (ret < 0) goto out_buf; /* read replies */ for (i = 0; i < 3; i++) { memset(buf, 0, NEXIO_BUFSIZE); ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep), buf, NEXIO_BUFSIZE, &actual_len, NEXIO_TIMEOUT); if (ret < 0 || actual_len < 1 || buf[1] != actual_len) continue; switch (buf[0]) { case 0x83: /* firmware version */ if (!firmware_ver) firmware_ver = kstrdup(&buf[2], GFP_KERNEL); break; case 0x84: /* device name */ if (!device_name) device_name = kstrdup(&buf[2], GFP_KERNEL); break; } } printk(KERN_INFO "Nexio device: %s, firmware version: %s\n", device_name, firmware_ver); kfree(firmware_ver); kfree(device_name); /* prepare ACK URB */ ret = -ENOMEM; usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); if (!usbtouch->priv) goto out_buf; priv = usbtouch->priv; - priv->ack_buf = kmalloc(sizeof(nexio_ack_pkt), GFP_KERNEL); + priv->ack_buf = kmemdup(nexio_ack_pkt, sizeof(nexio_ack_pkt), GFP_KERNEL); if (!priv->ack_buf) goto err_priv; - memcpy(priv->ack_buf, nexio_ack_pkt, sizeof(nexio_ack_pkt)); priv->ack = usb_alloc_urb(0, GFP_KERNEL); if (!priv->ack) { dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); goto err_ack_buf; } usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep), priv->ack_buf, sizeof(nexio_ack_pkt), nexio_ack_complete, usbtouch); ret = 0; goto out_buf; err_ack_buf: kfree(priv->ack_buf); err_priv: kfree(priv); out_buf: kfree(buf); return ret; }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
706
--- initial +++ final @@ -1,12 +1,11 @@ static int __init copy_keymap(void) { const struct key_entry *key; struct key_entry *new_keymap; unsigned int length = 1; for (key = keymap; key->type != KE_END; key++) length++; - new_keymap = kmalloc(length * sizeof(struct key_entry), GFP_KERNEL); + new_keymap = kmemdup(keymap, length * sizeof(struct key_entry), GFP_KERNEL); if (!new_keymap) return -ENOMEM; - memcpy(new_keymap, keymap, length * sizeof(struct key_entry)); keymap = new_keymap; return 0; }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
707
--- initial +++ final @@ -1,16 +1,15 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, const u8 *buffer, u16 len) { if (len <= USB_BUF_SZ) { memcpy(gspca_dev->usb_buf, buffer, len); usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x01, 0, gspca_dev->usb_buf, len, 500); } else { u8 *tmpbuf; - tmpbuf = kmalloc(len, GFP_KERNEL); + tmpbuf = kmemdup(buffer, len, GFP_KERNEL); if (!tmpbuf) { err("Out of memory"); return; } - memcpy(tmpbuf, buffer, len); usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x01, 0, tmpbuf, len, 500); kfree(tmpbuf); } }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
708
--- initial +++ final @@ -1,31 +1,30 @@ static int firmware_download(struct usb_device *udev) { int ret = 0, actual_length; const struct firmware *fw = NULL; void *fwbuf = NULL; size_t fwlength = 0, offset; size_t max_packet_size; ret = request_firmware(&fw, firmware_name, &udev->dev); if (ret) { log("download err : %d", ret); return ret; } fwlength = fw->size; - fwbuf = kzalloc(fwlength, GFP_KERNEL); + fwbuf = kmemdup(fw->data, fwlength, GFP_KERNEL); if (!fwbuf) { ret = -ENOMEM; goto out; } - memcpy(fwbuf, fw->data, fwlength); max_packet_size = udev->ep_out[0x1]->desc.wMaxPacketSize; log("\t\t download size : %d", (int)max_packet_size); for (offset = 0; offset < fwlength; offset += max_packet_size) { actual_length = 0; ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 0x01), /* ep 1 */ fwbuf + offset, min(max_packet_size, fwlength - offset), &actual_length, HZ * 10); if (ret) break; } kfree(fwbuf); out: release_firmware(fw); return ret; }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
710
--- initial +++ final @@ -1,63 +1,62 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) { struct codec_list *h = codeclist_top; struct attached_list *a, *ptr; struct videocodec *codec; int res; if (!master) { dprintk(1, KERN_ERR "videocodec_attach: no data\n"); return NULL; } dprintk(2, "videocodec_attach: '%s', flags %lx, magic %lx\n", master->name, master->flags, master->magic); if (!h) { dprintk(1, KERN_ERR "videocodec_attach: no device available\n"); return NULL; } while (h) { // attach only if the slave has at least the flags // expected by the master if ((master->flags & h->codec->flags) == master->flags) { dprintk(4, "videocodec_attach: try '%s'\n", h->codec->name); if (!try_module_get(h->codec->owner)) return NULL; - codec = kmalloc(sizeof(struct videocodec), GFP_KERNEL); + codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL); if (!codec) { dprintk(1, KERN_ERR "videocodec_attach: no mem\n"); goto out_module_put; } - memcpy(codec, h->codec, sizeof(struct videocodec)); snprintf(codec->name, sizeof(codec->name), "%s[%d]", codec->name, h->attached); codec->master_data = master; res = codec->setup(codec); if (res == 0) { dprintk(3, "videocodec_attach '%s'\n", codec->name); ptr = kzalloc(sizeof(struct attached_list), GFP_KERNEL); if (!ptr) { dprintk(1, KERN_ERR "videocodec_attach: no memory\n"); goto out_kfree; } ptr->codec = codec; a = h->list; if (!a) { h->list = ptr; dprintk(4, "videocodec: first element\n"); } else { while (a->next) a = a->next; // find end a->next = ptr; dprintk(4, "videocodec: in after '%s'\n", h->codec->name); } h->attached += 1; return codec; } else { kfree(codec); } } h = h->next; } dprintk(1, KERN_ERR "videocodec_attach: no codec found!\n"); return NULL; out_module_put: module_put(h->codec->owner); out_kfree: kfree(codec); return NULL; }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
711
--- initial +++ final @@ -1,64 +1,63 @@ int ceph_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) { struct inode *inode = dentry->d_inode; struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_vxattr_cb *vxattrs = ceph_inode_vxattrs(inode); int err; int name_len = strlen(name); int val_len = size; char *newname = NULL; char *newval = NULL; struct ceph_inode_xattr *xattr = NULL; int issued; int required_blob_size; if (ceph_snap(inode) != CEPH_NOSNAP) return -EROFS; if (!ceph_is_valid_xattr(name)) return -EOPNOTSUPP; if (vxattrs) { struct ceph_vxattr_cb *vxattr = ceph_match_vxattr(vxattrs, name); if (vxattr && vxattr->readonly) return -EOPNOTSUPP; } /* preallocate memory for xattr name, value, index node */ err = -ENOMEM; - newname = kmalloc(name_len + 1, GFP_NOFS); + newname = kmemdup(name, name_len + 1, GFP_NOFS); if (!newname) goto out; - memcpy(newname, name, name_len + 1); if (val_len) { newval = kmalloc(val_len + 1, GFP_NOFS); if (!newval) goto out; memcpy(newval, value, val_len); newval[val_len] = '\0'; } xattr = kmalloc(sizeof(struct ceph_inode_xattr), GFP_NOFS); if (!xattr) goto out; spin_lock(&inode->i_lock); retry: issued = __ceph_caps_issued(ci, NULL); if (!(issued & CEPH_CAP_XATTR_EXCL)) goto do_sync; __build_xattrs(inode); required_blob_size = __get_required_blob_size(ci, name_len, val_len); if (!ci->i_xattrs.prealloc_blob || required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) { struct ceph_buffer *blob = NULL; spin_unlock(&inode->i_lock); dout(" preaallocating new blob size=%d\n", required_blob_size); blob = ceph_buffer_new(required_blob_size, GFP_NOFS); if (!blob) goto out; spin_lock(&inode->i_lock); if (ci->i_xattrs.prealloc_blob) ceph_buffer_put(ci->i_xattrs.prealloc_blob); ci->i_xattrs.prealloc_blob = blob; goto retry; } dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued)); err = __set_xattr(ci, newname, name_len, newval, val_len, 1, 1, 1, &xattr); __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); ci->i_xattrs.dirty = true; inode->i_ctime = CURRENT_TIME; spin_unlock(&inode->i_lock); return err; do_sync: spin_unlock(&inode->i_lock); err = ceph_sync_setxattr(dentry, name, value, size, flags); out: kfree(newname); kfree(newval); kfree(xattr); return err; }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
712
--- initial +++ final @@ -1,118 +1,117 @@ static int jffs2_symlink(struct inode *dir_i, struct dentry *dentry, const char *target) { struct jffs2_inode_info *f, *dir_f; struct jffs2_sb_info *c; struct inode *inode; struct jffs2_raw_inode *ri; struct jffs2_raw_dirent *rd; struct jffs2_full_dnode *fn; struct jffs2_full_dirent *fd; int namelen; uint32_t alloclen; int ret, targetlen = strlen(target); /* FIXME: If you care. We'd need to use frags for the target if it grows much more than this */ if (targetlen > 254) return -ENAMETOOLONG; ri = jffs2_alloc_raw_inode(); if (!ri) return -ENOMEM; c = JFFS2_SB_INFO(dir_i->i_sb); /* Try to reserve enough space for both node and dirent. * Just the node will do for now, though */ namelen = dentry->d_name.len; ret = jffs2_reserve_space(c, sizeof(*ri) + targetlen, &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); if (ret) { jffs2_free_raw_inode(ri); return ret; } inode = jffs2_new_inode(dir_i, S_IFLNK | S_IRWXUGO, ri); if (IS_ERR(inode)) { jffs2_free_raw_inode(ri); jffs2_complete_reservation(c); return PTR_ERR(inode); } inode->i_op = &jffs2_symlink_inode_operations; f = JFFS2_INODE_INFO(inode); inode->i_size = targetlen; ri->isize = ri->dsize = ri->csize = cpu_to_je32(inode->i_size); ri->totlen = cpu_to_je32(sizeof(*ri) + inode->i_size); ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node) - 4)); ri->compr = JFFS2_COMPR_NONE; ri->data_crc = cpu_to_je32(crc32(0, target, targetlen)); ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri) - 8)); fn = jffs2_write_dnode(c, f, ri, target, targetlen, ALLOC_NORMAL); jffs2_free_raw_inode(ri); if (IS_ERR(fn)) { /* Eeek. Wave bye bye */ mutex_unlock(&f->sem); jffs2_complete_reservation(c); ret = PTR_ERR(fn); goto fail; } /* We use f->target field to store the target path. */ - f->target = kmalloc(targetlen + 1, GFP_KERNEL); + f->target = kmemdup(target, targetlen + 1, GFP_KERNEL); if (!f->target) { printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); mutex_unlock(&f->sem); jffs2_complete_reservation(c); ret = -ENOMEM; goto fail; } - memcpy(f->target, target, targetlen + 1); D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target)); /* No data here. Only a metadata node, which will be obsoleted by the first data write */ f->metadata = fn; mutex_unlock(&f->sem); jffs2_complete_reservation(c); ret = jffs2_init_security(inode, dir_i); if (ret) goto fail; ret = jffs2_init_acl_post(inode); if (ret) goto fail; ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); if (ret) goto fail; rd = jffs2_alloc_raw_dirent(); if (!rd) { /* Argh. Now we treat it like a normal delete */ jffs2_complete_reservation(c); ret = -ENOMEM; goto fail; } dir_f = JFFS2_INODE_INFO(dir_i); mutex_lock(&dir_f->sem); rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); rd->totlen = cpu_to_je32(sizeof(*rd) + namelen); rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node) - 4)); rd->pino = cpu_to_je32(dir_i->i_ino); rd->version = cpu_to_je32(++dir_f->highest_version); rd->ino = cpu_to_je32(inode->i_ino); rd->mctime = cpu_to_je32(get_seconds()); rd->nsize = namelen; rd->type = DT_LNK; rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd) - 8)); rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen)); fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL); if (IS_ERR(fd)) { /* dirent failed to write. Delete the inode normally as if it were the final unlink() */ jffs2_complete_reservation(c); jffs2_free_raw_dirent(rd); mutex_unlock(&dir_f->sem); ret = PTR_ERR(fd); goto fail; } dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); jffs2_free_raw_dirent(rd); /* Link the fd into the inode's list, obsoleting an old one if necessary. */ jffs2_add_fd_to_list(c, fd, &dir_f->dents); mutex_unlock(&dir_f->sem); jffs2_complete_reservation(c); d_instantiate(dentry, inode); unlock_new_inode(inode); return 0; fail: iget_failed(inode); return ret; }<sep>@@ expression from,to,size,flag; statement S; @@ - to = \(kmalloc\|kzalloc\)(size,flag); + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); <|end_of_text|>
713
--- initial +++ final @@ -1,24 +1,22 @@ static int vf610_ocotp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct vf610_ocotp *ocotp_dev; ocotp_dev = devm_kzalloc(&pdev->dev, sizeof(struct vf610_ocotp), GFP_KERNEL); if (!ocotp_dev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ocotp_dev->base = devm_ioremap_resource(dev, res); if (IS_ERR(ocotp_dev->base)) return PTR_ERR(ocotp_dev->base); ocotp_dev->clk = devm_clk_get(dev, NULL); if (IS_ERR(ocotp_dev->clk)) { dev_err(dev, "failed getting clock, err = %ld\n", PTR_ERR(ocotp_dev->clk)); return PTR_ERR(ocotp_dev->clk); } ocotp_config.size = resource_size(res); ocotp_config.priv = ocotp_dev; ocotp_config.dev = dev; - ocotp_dev->nvmem = nvmem_register(&ocotp_config); - if (IS_ERR(ocotp_dev->nvmem)) return PTR_ERR(ocotp_dev->nvmem); ocotp_dev->dev = dev; - platform_set_drvdata(pdev, ocotp_dev); ocotp_dev->timing = vf610_ocotp_calculate_timing(ocotp_dev); - return 0; + ocotp_dev->nvmem = devm_nvmem_register(dev, &ocotp_config); + return PTR_ERR_OR_ZERO(ocotp_dev->nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
714
--- initial +++ final @@ -1,24 +1,22 @@ static int vf610_ocotp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct vf610_ocotp *ocotp_dev; ocotp_dev = devm_kzalloc(&pdev->dev, sizeof(struct vf610_ocotp), GFP_KERNEL); if (!ocotp_dev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ocotp_dev->base = devm_ioremap_resource(dev, res); if (IS_ERR(ocotp_dev->base)) return PTR_ERR(ocotp_dev->base); ocotp_dev->clk = devm_clk_get(dev, NULL); if (IS_ERR(ocotp_dev->clk)) { dev_err(dev, "failed getting clock, err = %ld\n", PTR_ERR(ocotp_dev->clk)); return PTR_ERR(ocotp_dev->clk); } ocotp_config.size = resource_size(res); ocotp_config.priv = ocotp_dev; ocotp_config.dev = dev; - ocotp_dev->nvmem = nvmem_register(&ocotp_config); - if (IS_ERR(ocotp_dev->nvmem)) return PTR_ERR(ocotp_dev->nvmem); ocotp_dev->dev = dev; - platform_set_drvdata(pdev, ocotp_dev); ocotp_dev->timing = vf610_ocotp_calculate_timing(ocotp_dev); - return 0; + ocotp_dev->nvmem = devm_nvmem_register(dev, &ocotp_config); + return PTR_ERR_OR_ZERO(ocotp_dev->nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
715
--- initial +++ final @@ -1,25 +1,23 @@ static int imx_ocotp_probe(struct platform_device *pdev) { const struct of_device_id *of_id; struct device *dev = &pdev->dev; struct resource *res; struct ocotp_priv *priv; struct nvmem_device *nvmem; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); priv->clk = devm_clk_get(dev, NULL); if (IS_ERR(priv->clk)) return PTR_ERR(priv->clk); of_id = of_match_device(imx_ocotp_dt_ids, dev); priv->params = of_device_get_match_data(&pdev->dev); imx_ocotp_nvmem_config.size = 4 * priv->params->nregs; imx_ocotp_nvmem_config.dev = dev; imx_ocotp_nvmem_config.priv = priv; priv->config = &imx_ocotp_nvmem_config; - nvmem = nvmem_register(&imx_ocotp_nvmem_config); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &imx_ocotp_nvmem_config); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
716
--- initial +++ final @@ -1,25 +1,23 @@ static int imx_ocotp_probe(struct platform_device *pdev) { const struct of_device_id *of_id; struct device *dev = &pdev->dev; struct resource *res; struct ocotp_priv *priv; struct nvmem_device *nvmem; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); priv->clk = devm_clk_get(dev, NULL); if (IS_ERR(priv->clk)) return PTR_ERR(priv->clk); of_id = of_match_device(imx_ocotp_dt_ids, dev); priv->params = of_device_get_match_data(&pdev->dev); imx_ocotp_nvmem_config.size = 4 * priv->params->nregs; imx_ocotp_nvmem_config.dev = dev; imx_ocotp_nvmem_config.priv = priv; priv->config = &imx_ocotp_nvmem_config; - nvmem = nvmem_register(&imx_ocotp_nvmem_config); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &imx_ocotp_nvmem_config); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
717
--- initial +++ final @@ -1,23 +1,21 @@ static int uniphier_efuse_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct nvmem_device *nvmem; struct nvmem_config econfig = {}; struct uniphier_efuse_priv *priv; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); econfig.stride = 1; econfig.word_size = 1; econfig.read_only = true; econfig.reg_read = uniphier_reg_read; econfig.size = resource_size(res); econfig.priv = priv; econfig.dev = dev; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
718
--- initial +++ final @@ -1,23 +1,21 @@ static int uniphier_efuse_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct nvmem_device *nvmem; struct nvmem_config econfig = {}; struct uniphier_efuse_priv *priv; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); econfig.stride = 1; econfig.word_size = 1; econfig.read_only = true; econfig.reg_read = uniphier_reg_read; econfig.size = resource_size(res); econfig.priv = priv; econfig.dev = dev; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
719
--- initial +++ final @@ -1,28 +1,26 @@ static int rockchip_efuse_probe(struct platform_device *pdev) { struct resource *res; struct nvmem_device *nvmem; struct rockchip_efuse_chip *efuse; const struct of_device_id *match; struct device *dev = &pdev->dev; match = of_match_device(dev->driver->of_match_table, dev); if (!match || !match->data) { dev_err(dev, "failed to get match data\n"); return -EINVAL; } efuse = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_efuse_chip), GFP_KERNEL); if (!efuse) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); efuse->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(efuse->base)) return PTR_ERR(efuse->base); efuse->clk = devm_clk_get(&pdev->dev, "pclk_efuse"); if (IS_ERR(efuse->clk)) return PTR_ERR(efuse->clk); efuse->dev = &pdev->dev; if (of_property_read_u32(dev->of_node, "rockchip,efuse-size", &econfig.size)) econfig.size = resource_size(res); econfig.reg_read = match->data; econfig.priv = efuse; econfig.dev = efuse->dev; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
720
--- initial +++ final @@ -1,28 +1,26 @@ static int rockchip_efuse_probe(struct platform_device *pdev) { struct resource *res; struct nvmem_device *nvmem; struct rockchip_efuse_chip *efuse; const struct of_device_id *match; struct device *dev = &pdev->dev; match = of_match_device(dev->driver->of_match_table, dev); if (!match || !match->data) { dev_err(dev, "failed to get match data\n"); return -EINVAL; } efuse = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_efuse_chip), GFP_KERNEL); if (!efuse) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); efuse->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(efuse->base)) return PTR_ERR(efuse->base); efuse->clk = devm_clk_get(&pdev->dev, "pclk_efuse"); if (IS_ERR(efuse->clk)) return PTR_ERR(efuse->clk); efuse->dev = &pdev->dev; if (of_property_read_u32(dev->of_node, "rockchip,efuse-size", &econfig.size)) econfig.size = resource_size(res); econfig.reg_read = match->data; econfig.priv = efuse; econfig.dev = efuse->dev; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
721
--- initial +++ final @@ -1,23 +1,21 @@ static int mtk_efuse_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct nvmem_device *nvmem; struct nvmem_config econfig = {}; struct mtk_efuse_priv *priv; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); econfig.stride = 4; econfig.word_size = 4; econfig.reg_read = mtk_reg_read; econfig.reg_write = mtk_reg_write; econfig.size = resource_size(res); econfig.priv = priv; econfig.dev = dev; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
722
--- initial +++ final @@ -1,23 +1,21 @@ static int mtk_efuse_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct nvmem_device *nvmem; struct nvmem_config econfig = {}; struct mtk_efuse_priv *priv; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); econfig.stride = 4; econfig.word_size = 4; econfig.reg_read = mtk_reg_read; econfig.reg_write = mtk_reg_write; econfig.size = resource_size(res); econfig.priv = priv; econfig.dev = dev; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
723
--- initial +++ final @@ -1,30 +1,28 @@ static int meson_mx_efuse_probe(struct platform_device *pdev) { const struct meson_mx_efuse_platform_data *drvdata; struct meson_mx_efuse *efuse; struct resource *res; drvdata = of_device_get_match_data(&pdev->dev); if (!drvdata) return -EINVAL; efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); if (!efuse) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); efuse->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(efuse->base)) return PTR_ERR(efuse->base); efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name, GFP_KERNEL); efuse->config.owner = THIS_MODULE; efuse->config.dev = &pdev->dev; efuse->config.priv = efuse; efuse->config.stride = drvdata->word_size; efuse->config.word_size = drvdata->word_size; efuse->config.size = SZ_512; efuse->config.read_only = true; efuse->config.reg_read = meson_mx_efuse_read; efuse->core_clk = devm_clk_get(&pdev->dev, "core"); if (IS_ERR(efuse->core_clk)) { dev_err(&pdev->dev, "Failed to get core clock\n"); return PTR_ERR(efuse->core_clk); } - efuse->nvmem = nvmem_register(&efuse->config); - if (IS_ERR(efuse->nvmem)) return PTR_ERR(efuse->nvmem); - platform_set_drvdata(pdev, efuse); - return 0; + efuse->nvmem = devm_nvmem_register(&pdev->dev, &efuse->config); + return PTR_ERR_OR_ZERO(efuse->nvmem); }<sep>@@ expression nvmem,e,e1,pdev; @@ - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(&pdev->dev, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
724
--- initial +++ final @@ -1,30 +1,28 @@ static int meson_mx_efuse_probe(struct platform_device *pdev) { const struct meson_mx_efuse_platform_data *drvdata; struct meson_mx_efuse *efuse; struct resource *res; drvdata = of_device_get_match_data(&pdev->dev); if (!drvdata) return -EINVAL; efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); if (!efuse) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); efuse->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(efuse->base)) return PTR_ERR(efuse->base); efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name, GFP_KERNEL); efuse->config.owner = THIS_MODULE; efuse->config.dev = &pdev->dev; efuse->config.priv = efuse; efuse->config.stride = drvdata->word_size; efuse->config.word_size = drvdata->word_size; efuse->config.size = SZ_512; efuse->config.read_only = true; efuse->config.reg_read = meson_mx_efuse_read; efuse->core_clk = devm_clk_get(&pdev->dev, "core"); if (IS_ERR(efuse->core_clk)) { dev_err(&pdev->dev, "Failed to get core clock\n"); return PTR_ERR(efuse->core_clk); } - efuse->nvmem = nvmem_register(&efuse->config); - if (IS_ERR(efuse->nvmem)) return PTR_ERR(efuse->nvmem); - platform_set_drvdata(pdev, efuse); - return 0; + efuse->nvmem = devm_nvmem_register(&pdev->dev, &efuse->config); + return PTR_ERR_OR_ZERO(efuse->nvmem); }<sep>@@ expression nvmem,e,e1,pdev; @@ - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(&pdev->dev, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
725
--- initial +++ final @@ -1,12 +1,10 @@ static int meson_efuse_probe(struct platform_device *pdev) { struct nvmem_device *nvmem; unsigned int size; if (meson_sm_call(SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0) return -EINVAL; econfig.dev = &pdev->dev; econfig.reg_read = meson_efuse_read; econfig.size = size; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(&pdev->dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; @@ - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(&pdev->dev, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
726
--- initial +++ final @@ -1,12 +1,10 @@ static int meson_efuse_probe(struct platform_device *pdev) { struct nvmem_device *nvmem; unsigned int size; if (meson_sm_call(SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0) return -EINVAL; econfig.dev = &pdev->dev; econfig.reg_read = meson_efuse_read; econfig.size = size; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(&pdev->dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; @@ - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(&pdev->dev, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
727
--- initial +++ final @@ -1,17 +1,15 @@ static int lpc18xx_otp_probe(struct platform_device *pdev) { struct nvmem_device *nvmem; struct lpc18xx_otp *otp; struct resource *res; otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); if (!otp) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); otp->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(otp->base)) return PTR_ERR(otp->base); lpc18xx_otp_nvmem_config.size = LPC18XX_OTP_SIZE; lpc18xx_otp_nvmem_config.dev = &pdev->dev; lpc18xx_otp_nvmem_config.priv = otp; - nvmem = nvmem_register(&lpc18xx_otp_nvmem_config); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(&pdev->dev, &lpc18xx_otp_nvmem_config); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; @@ - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(&pdev->dev, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
728
--- initial +++ final @@ -1,17 +1,15 @@ static int lpc18xx_otp_probe(struct platform_device *pdev) { struct nvmem_device *nvmem; struct lpc18xx_otp *otp; struct resource *res; otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); if (!otp) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); otp->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(otp->base)) return PTR_ERR(otp->base); lpc18xx_otp_nvmem_config.size = LPC18XX_OTP_SIZE; lpc18xx_otp_nvmem_config.dev = &pdev->dev; lpc18xx_otp_nvmem_config.priv = otp; - nvmem = nvmem_register(&lpc18xx_otp_nvmem_config); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(&pdev->dev, &lpc18xx_otp_nvmem_config); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; @@ - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(&pdev->dev, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
729
--- initial +++ final @@ -1,26 +1,24 @@ static int imx_iim_probe(struct platform_device *pdev) { const struct of_device_id *of_id; struct device *dev = &pdev->dev; struct resource *res; struct iim_priv *iim; struct nvmem_device *nvmem; struct nvmem_config cfg = {}; const struct imx_iim_drvdata *drvdata = NULL; iim = devm_kzalloc(dev, sizeof(*iim), GFP_KERNEL); if (!iim) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); iim->base = devm_ioremap_resource(dev, res); if (IS_ERR(iim->base)) return PTR_ERR(iim->base); of_id = of_match_device(imx_iim_dt_ids, dev); if (!of_id) return -ENODEV; drvdata = of_id->data; iim->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(iim->clk)) return PTR_ERR(iim->clk); cfg.name = "imx-iim", cfg.read_only = true, cfg.word_size = 1, cfg.stride = 1, cfg.reg_read = imx_iim_read, cfg.dev = dev; cfg.size = drvdata->nregs; cfg.priv = iim; - nvmem = nvmem_register(&cfg); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &cfg); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
730
--- initial +++ final @@ -1,26 +1,24 @@ static int imx_iim_probe(struct platform_device *pdev) { const struct of_device_id *of_id; struct device *dev = &pdev->dev; struct resource *res; struct iim_priv *iim; struct nvmem_device *nvmem; struct nvmem_config cfg = {}; const struct imx_iim_drvdata *drvdata = NULL; iim = devm_kzalloc(dev, sizeof(*iim), GFP_KERNEL); if (!iim) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); iim->base = devm_ioremap_resource(dev, res); if (IS_ERR(iim->base)) return PTR_ERR(iim->base); of_id = of_match_device(imx_iim_dt_ids, dev); if (!of_id) return -ENODEV; drvdata = of_id->data; iim->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(iim->clk)) return PTR_ERR(iim->clk); cfg.name = "imx-iim", cfg.read_only = true, cfg.word_size = 1, cfg.stride = 1, cfg.reg_read = imx_iim_read, cfg.dev = dev; cfg.size = drvdata->nregs; cfg.priv = iim; - nvmem = nvmem_register(&cfg); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &cfg); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
731
--- initial +++ final @@ -1,53 +1,52 @@ static int bcm_otpc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *dn = dev->of_node; struct resource *res; struct otpc_priv *priv; struct nvmem_device *nvmem; int err; u32 num_words; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; if (of_device_is_compatible(dev->of_node, "brcm,ocotp")) priv->map = &otp_map; else if (of_device_is_compatible(dev->of_node, "brcm,ocotp-v2")) priv->map = &otp_map_v2; else { dev_err(&pdev->dev, "%s otpc config map not defined\n", __func__); return -EINVAL; } /* Get OTP base address register. */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) { dev_err(dev, "unable to map I/O memory\n"); return PTR_ERR(priv->base); } /* Enable CPU access to OTPC. */ writel(readl(priv->base + OTPC_MODE_REG_OFFSET) | BIT(OTPC_MODE_REG_OTPC_MODE), priv->base + OTPC_MODE_REG_OFFSET); reset_start_bit(priv->base); /* Read size of memory in words. */ err = of_property_read_u32(dn, "brcm,ocotp-size", &num_words); if (err) { dev_err(dev, "size parameter not specified\n"); return -EINVAL; } else if (num_words == 0) { dev_err(dev, "size must be > 0\n"); return -EINVAL; } bcm_otpc_nvmem_config.size = 4 * num_words; bcm_otpc_nvmem_config.dev = dev; bcm_otpc_nvmem_config.priv = priv; if (of_device_is_compatible(dev->of_node, "brcm,ocotp-v2")) { bcm_otpc_nvmem_config.word_size = 8; bcm_otpc_nvmem_config.stride = 8; } priv->config = &bcm_otpc_nvmem_config; - nvmem = nvmem_register(&bcm_otpc_nvmem_config); + nvmem = devm_nvmem_register(dev, &bcm_otpc_nvmem_config); if (IS_ERR(nvmem)) { dev_err(dev, "error registering nvmem config\n"); return PTR_ERR(nvmem); } - platform_set_drvdata(pdev, nvmem); return 0; }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); + nvmem = devm_nvmem_register(d, e); if (IS_ERR(nvmem)) { ... } ... - platform_set_drvdata(pdev, e1); <|end_of_text|>
732
--- initial +++ final @@ -1,53 +1,52 @@ static int bcm_otpc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *dn = dev->of_node; struct resource *res; struct otpc_priv *priv; struct nvmem_device *nvmem; int err; u32 num_words; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; if (of_device_is_compatible(dev->of_node, "brcm,ocotp")) priv->map = &otp_map; else if (of_device_is_compatible(dev->of_node, "brcm,ocotp-v2")) priv->map = &otp_map_v2; else { dev_err(&pdev->dev, "%s otpc config map not defined\n", __func__); return -EINVAL; } /* Get OTP base address register. */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) { dev_err(dev, "unable to map I/O memory\n"); return PTR_ERR(priv->base); } /* Enable CPU access to OTPC. */ writel(readl(priv->base + OTPC_MODE_REG_OFFSET) | BIT(OTPC_MODE_REG_OTPC_MODE), priv->base + OTPC_MODE_REG_OFFSET); reset_start_bit(priv->base); /* Read size of memory in words. */ err = of_property_read_u32(dn, "brcm,ocotp-size", &num_words); if (err) { dev_err(dev, "size parameter not specified\n"); return -EINVAL; } else if (num_words == 0) { dev_err(dev, "size must be > 0\n"); return -EINVAL; } bcm_otpc_nvmem_config.size = 4 * num_words; bcm_otpc_nvmem_config.dev = dev; bcm_otpc_nvmem_config.priv = priv; if (of_device_is_compatible(dev->of_node, "brcm,ocotp-v2")) { bcm_otpc_nvmem_config.word_size = 8; bcm_otpc_nvmem_config.stride = 8; } priv->config = &bcm_otpc_nvmem_config; - nvmem = nvmem_register(&bcm_otpc_nvmem_config); + nvmem = devm_nvmem_register(dev, &bcm_otpc_nvmem_config); if (IS_ERR(nvmem)) { dev_err(dev, "error registering nvmem config\n"); return PTR_ERR(nvmem); } - platform_set_drvdata(pdev, nvmem); return 0; }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); + nvmem = devm_nvmem_register(d, e); if (IS_ERR(nvmem)) { ... } ... - platform_set_drvdata(pdev, e1); <|end_of_text|>
733
--- initial +++ final @@ -1,18 +1,16 @@ static int qfprom_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct nvmem_device *nvmem; struct qfprom_priv *priv; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); econfig.size = resource_size(res); econfig.dev = dev; econfig.priv = priv; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
734
--- initial +++ final @@ -1,18 +1,16 @@ static int qfprom_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct nvmem_device *nvmem; struct qfprom_priv *priv; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); econfig.size = resource_size(res); econfig.dev = dev; econfig.priv = priv; - nvmem = nvmem_register(&econfig); - if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - platform_set_drvdata(pdev, nvmem); - return 0; + nvmem = devm_nvmem_register(dev, &econfig); + return PTR_ERR_OR_ZERO(nvmem); }<sep>@@ expression nvmem,e,e1,pdev; identifier d; @@ struct device *d = &pdev->dev; ... when exists - nvmem = nvmem_register(e); - if (IS_ERR(nvmem)) - return PTR_ERR(nvmem); ... - platform_set_drvdata(pdev, e1); ... - return 0; + nvmem = devm_nvmem_register(d, e); + return PTR_ERR_OR_ZERO(nvmem); <|end_of_text|>
735
--- initial +++ final @@ -1,22 +1,22 @@ int ll_d_init(struct dentry *de) { LASSERT(de != NULL); CDEBUG(D_DENTRY, "ldd on dentry %.*s (%p) parent %p inode %p refc %d\n", de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode, d_count(de)); if (de->d_fsdata == NULL) { struct ll_dentry_data *lld; - OBD_ALLOC_PTR(lld); - if (likely(lld != NULL)) { + lld = kzalloc(sizeof(*lld), GFP_NOFS); + if (likely(lld)) { spin_lock(&de->d_lock); if (likely(de->d_fsdata == NULL)) { de->d_fsdata = lld; __d_lustre_invalidate(de); } else { OBD_FREE_PTR(lld); } spin_unlock(&de->d_lock); } else { return -ENOMEM; } } LASSERT(de->d_op == &ll_d_ops); return 0; }<sep>@@ expression e; statement S1,S2; @@ - OBD_ALLOC_PTR(e); + e = kzalloc(sizeof(*e), GFP_NOFS); if (likely( - e != NULL + e )) S1 else S2 <|end_of_text|>
736
--- initial +++ final @@ -1,77 +1,77 @@ static int ll_dir_filler(void *_hash, struct page *page0) { struct inode *inode = page0->mapping->host; int hash64 = ll_i2sbi(inode)->ll_flags & LL_SBI_64BIT_HASH; struct obd_export *exp = ll_i2sbi(inode)->ll_md_exp; struct ptlrpc_request *request; struct mdt_body *body; struct md_op_data *op_data; __u64 hash = *((__u64 *)_hash); struct page **page_pool; struct page *page; struct lu_dirpage *dp; int max_pages = ll_i2sbi(inode)->ll_md_brw_size >> PAGE_CACHE_SHIFT; int nrdpgs = 0; /* number of pages read actually */ int npages; int i; int rc; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) hash %llu\n", inode->i_ino, inode->i_generation, inode, hash); LASSERT(max_pages > 0 && max_pages <= MD_MAX_BRW_PAGES); - OBD_ALLOC(page_pool, sizeof(page) * max_pages); - if (page_pool != NULL) { + page_pool = kzalloc(sizeof(page) * max_pages, GFP_NOFS); + if (page_pool) { page_pool[0] = page0; } else { page_pool = &page0; max_pages = 1; } for (npages = 1; npages < max_pages; npages++) { page = page_cache_alloc_cold(inode->i_mapping); if (!page) break; page_pool[npages] = page; } op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); op_data->op_npages = npages; op_data->op_offset = hash; rc = md_readpage(exp, op_data, page_pool, &request); ll_finish_md_op_data(op_data); if (rc == 0) { body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); /* Checked by mdc_readpage() */ LASSERT(body != NULL); if (body->valid & OBD_MD_FLSIZE) cl_isize_write(inode, body->size); nrdpgs = (request->rq_bulk->bd_nob_transferred + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; SetPageUptodate(page0); } unlock_page(page0); ptlrpc_req_finished(request); CDEBUG(D_VFSTRACE, "read %d/%d pages\n", nrdpgs, npages); ll_pagevec_init(&lru_pvec, 0); for (i = 1; i < npages; i++) { unsigned long offset; int ret; page = page_pool[i]; if (rc < 0 || i >= nrdpgs) { page_cache_release(page); continue; } SetPageUptodate(page); dp = kmap(page); hash = le64_to_cpu(dp->ldp_hash_start); kunmap(page); offset = hash_x_index(hash, hash64); prefetchw(&page->flags); ret = add_to_page_cache_lru(page, inode->i_mapping, offset, GFP_KERNEL); if (ret == 0) { unlock_page(page); if (ll_pagevec_add(&lru_pvec, page) == 0) ll_pagevec_lru_add_file(&lru_pvec); } else { CDEBUG(D_VFSTRACE, "page %lu add to page cache failed:" " %d\n", offset, ret); } page_cache_release(page); } ll_pagevec_lru_add_file(&lru_pvec); if (page_pool != &page0) OBD_FREE(page_pool, sizeof(struct page *) * max_pages); return rc; }<sep>@@ expression e,sz; statement S1,S2; @@ - OBD_ALLOC(e,sz); + e = kzalloc(sz, GFP_NOFS); if (likely( - e != NULL + e )) S1 else S2 <|end_of_text|>
738
--- initial +++ final @@ -1,80 +1,80 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt) { struct lustre_profile *lprof = NULL; struct lustre_sb_info *lsi = s2lsi(sb); struct ll_sb_info *sbi; char *dt = NULL, *md = NULL; char *profilenm = get_profile_name(sb); struct config_llog_instance *cfg; /* %p for void* in printf needs 16+2 characters: 0xffffffffffffffff */ const int instlen = sizeof(cfg->cfg_instance) * 2 + 2; int err; CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb); - OBD_ALLOC_PTR(cfg); - if (cfg == NULL) return -ENOMEM; + cfg = kzalloc(sizeof(*cfg), GFP_NOFS); + if (!cfg) return -ENOMEM; try_module_get(THIS_MODULE); /* client additional sb info */ lsi->lsi_llsbi = sbi = ll_init_sbi(); if (!sbi) { module_put(THIS_MODULE); OBD_FREE_PTR(cfg); return -ENOMEM; } err = ll_options(lsi->lsi_lmd->lmd_opts, &sbi->ll_flags); if (err) goto out_free; err = bdi_init(&lsi->lsi_bdi); if (err) goto out_free; lsi->lsi_flags |= LSI_BDI_INITIALIZED; lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY; err = ll_bdi_register(&lsi->lsi_bdi); if (err) goto out_free; sb->s_bdi = &lsi->lsi_bdi; /* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */ sb->s_d_op = &ll_d_ops; /* Generate a string unique to this super, in case some joker tries to mount the same fs at two mount points. Use the address of the super itself.*/ cfg->cfg_instance = sb; cfg->cfg_uuid = lsi->lsi_llsbi->ll_sb_uuid; cfg->cfg_callback = class_config_llog_handler; /* set up client obds */ err = lustre_process_log(sb, profilenm, cfg); if (err < 0) { CERROR("Unable to process log: %d\n", err); goto out_free; } /* Profile set with LCFG_MOUNTOPT so we can find our mdc and osc obds */ lprof = class_get_profile(profilenm); if (lprof == NULL) { LCONSOLE_ERROR_MSG(0x156, "The client profile '%s' could not be" " read from the MGS. Does that filesystem " "exist?\n", profilenm); err = -EINVAL; goto out_free; } CDEBUG(D_CONFIG, "Found profile %s: mdc=%s osc=%s\n", profilenm, lprof->lp_md, lprof->lp_dt); - OBD_ALLOC(dt, strlen(lprof->lp_dt) + instlen + 2); + dt = kzalloc(strlen(lprof->lp_dt) + instlen + 2, GFP_NOFS); if (!dt) { err = -ENOMEM; goto out_free; } sprintf(dt, "%s-%p", lprof->lp_dt, cfg->cfg_instance); - OBD_ALLOC(md, strlen(lprof->lp_md) + instlen + 2); + md = kzalloc(strlen(lprof->lp_md) + instlen + 2, GFP_NOFS); if (!md) { err = -ENOMEM; goto out_free; } sprintf(md, "%s-%p", lprof->lp_md, cfg->cfg_instance); /* connections, registrations, sb setup */ err = client_common_fill_super(sb, md, dt, mnt); out_free: if (md) OBD_FREE(md, strlen(lprof->lp_md) + instlen + 2); if (dt) OBD_FREE(dt, strlen(lprof->lp_dt) + instlen + 2); if (err) ll_put_super(sb); else if (sbi->ll_flags & LL_SBI_VERBOSE) LCONSOLE_WARN("Mounted %s\n", profilenm); OBD_FREE_PTR(cfg); return err; }<sep>@@ expression e; statement S1,S2; @@ - OBD_ALLOC_PTR(e); + e = kzalloc(sizeof(*e), GFP_NOFS); if (unlikely( - e == NULL + !e )) S1 else S2 @@ expression e,sz; statement S1,S2; @@ - OBD_ALLOC(e,sz); + e = kzalloc(sz, GFP_NOFS); if (unlikely( - e == NULL + !e )) S1 else S2 <|end_of_text|>
757
--- initial +++ final @@ -1,42 +1,42 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, struct inode *i2, const char *name, int namelen, int mode, __u32 opc, void *data) { LASSERT(i1 != NULL); if (namelen > ll_i2sbi(i1)->ll_namelen) return ERR_PTR(-ENAMETOOLONG); - if (op_data == NULL) OBD_ALLOC_PTR(op_data); + if (op_data == NULL) op_data = kzalloc(sizeof(*op_data), GFP_NOFS); if (op_data == NULL) return ERR_PTR(-ENOMEM); ll_i2gids(op_data->op_suppgids, i1, i2); op_data->op_fid1 = *ll_inode2fid(i1); op_data->op_capa1 = ll_mdscapa_get(i1); if (i2) { op_data->op_fid2 = *ll_inode2fid(i2); op_data->op_capa2 = ll_mdscapa_get(i2); } else { fid_zero(&op_data->op_fid2); op_data->op_capa2 = NULL; } op_data->op_name = name; op_data->op_namelen = namelen; op_data->op_mode = mode; op_data->op_mod_time = get_seconds(); op_data->op_fsuid = from_kuid(&init_user_ns, current_fsuid()); op_data->op_fsgid = from_kgid(&init_user_ns, current_fsgid()); op_data->op_cap = cfs_curproc_cap_pack(); op_data->op_bias = 0; op_data->op_cli_flags = 0; if ((opc == LUSTRE_OPC_CREATE) && (name != NULL) && filename_is_volatile(name, namelen, NULL)) op_data->op_bias |= MDS_CREATE_VOLATILE; op_data->op_opc = opc; op_data->op_mds = 0; op_data->op_data = data; /* If the file is being opened after mknod() (normally due to NFS) * try to use the default stripe data from parent directory for * allocating OST objects. Try to pass the parent FID to MDS. */ if (opc == LUSTRE_OPC_CREATE && i1 == i2 && S_ISREG(i2->i_mode) && !ll_i2info(i2)->lli_has_smd) { struct ll_inode_info *lli = ll_i2info(i2); spin_lock(&lli->lli_lock); if (likely(!lli->lli_has_smd && !fid_is_zero(&lli->lli_pfid))) op_data->op_fid1 = lli->lli_pfid; spin_unlock(&lli->lli_lock); /** We ignore parent's capability temporary. */ } /* When called by ll_setattr_raw, file is i1. */ if (LLIF_DATA_MODIFIED & ll_i2info(i1)->lli_flags) op_data->op_bias |= MDS_DATA_MODIFIED; return op_data; }<sep>@@ expression e; @@ - OBD_ALLOC_PTR(e); + e = kzalloc(sizeof(*e), GFP_NOFS); <|end_of_text|>
759
--- initial +++ final @@ -1,29 +1,29 @@ void ll_umount_begin(struct super_block *sb) { struct ll_sb_info *sbi = ll_s2sbi(sb); struct obd_device *obd; struct obd_ioctl_data *ioc_data; CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb, sb->s_count, atomic_read(&sb->s_active)); obd = class_exp2obd(sbi->ll_md_exp); if (obd == NULL) { CERROR("Invalid MDC connection handle %#llx\n", sbi->ll_md_exp->exp_handle.h_cookie); return; } obd->obd_force = 1; obd = class_exp2obd(sbi->ll_dt_exp); if (obd == NULL) { CERROR("Invalid LOV connection handle %#llx\n", sbi->ll_dt_exp->exp_handle.h_cookie); return; } obd->obd_force = 1; - OBD_ALLOC_PTR(ioc_data); + ioc_data = kzalloc(sizeof(*ioc_data), GFP_NOFS); if (ioc_data) { obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_md_exp, sizeof(*ioc_data), ioc_data, NULL); obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_dt_exp, sizeof(*ioc_data), ioc_data, NULL); OBD_FREE_PTR(ioc_data); } /* Really, we'd like to wait until there are no requests outstanding, * and then continue. For now, we just invalidate the requests, * schedule() and sleep one second if needed, and hope. */ schedule(); }<sep>@@ expression e; statement S1,S2; @@ - OBD_ALLOC_PTR(e); + e = kzalloc(sizeof(*e), GFP_NOFS); if (likely( - e != NULL + e )) S1 else S2 <|end_of_text|>
761
--- initial +++ final @@ -1,63 +1,63 @@ static int __init lloop_init(void) { int i; unsigned int cmdlist[] = { LL_IOC_LLOOP_ATTACH, LL_IOC_LLOOP_DETACH_BYDEV, }; if (max_loop < 1 || max_loop > 256) { max_loop = MAX_LOOP_DEFAULT; CWARN("lloop: invalid max_loop (must be between" " 1 and 256), using default (%u)\n", max_loop); } lloop_major = register_blkdev(0, "lloop"); if (lloop_major < 0) return -EIO; CDEBUG(D_CONFIG, "registered lloop major %d with %u minors\n", lloop_major, max_loop); ll_iocontrol_magic = ll_iocontrol_register(lloop_ioctl, 2, cmdlist); if (ll_iocontrol_magic == NULL) goto out_mem1; - OBD_ALLOC_WAIT(loop_dev, max_loop * sizeof(*loop_dev)); + loop_dev = kzalloc(max_loop * sizeof(*loop_dev), GFP_KERNEL); if (!loop_dev) goto out_mem1; - OBD_ALLOC_WAIT(disks, max_loop * sizeof(*disks)); + disks = kzalloc(max_loop * sizeof(*disks), GFP_KERNEL); if (!disks) goto out_mem2; for (i = 0; i < max_loop; i++) { disks[i] = alloc_disk(1); if (!disks[i]) goto out_mem3; } mutex_init(&lloop_mutex); for (i = 0; i < max_loop; i++) { struct lloop_device *lo = &loop_dev[i]; struct gendisk *disk = disks[i]; lo->lo_queue = blk_alloc_queue(GFP_KERNEL); if (!lo->lo_queue) goto out_mem4; mutex_init(&lo->lo_ctl_mutex); sema_init(&lo->lo_sem, 0); init_waitqueue_head(&lo->lo_bh_wait); lo->lo_number = i; spin_lock_init(&lo->lo_lock); disk->major = lloop_major; disk->first_minor = i; disk->fops = &lo_fops; sprintf(disk->disk_name, "lloop%d", i); disk->private_data = lo; disk->queue = lo->lo_queue; } /* We cannot fail after we call this, so another loop!*/ for (i = 0; i < max_loop; i++) add_disk(disks[i]); return 0; out_mem4: while (i--) blk_cleanup_queue(loop_dev[i].lo_queue); i = max_loop; out_mem3: while (i--) put_disk(disks[i]); OBD_FREE(disks, max_loop * sizeof(*disks)); out_mem2: OBD_FREE(loop_dev, max_loop * sizeof(*loop_dev)); out_mem1: unregister_blkdev(lloop_major, "lloop"); ll_iocontrol_unregister(ll_iocontrol_magic); CERROR("lloop: ran out of memory\n"); return -ENOMEM; }<sep>@@ expression e,sz; statement S1,S2; @@ - OBD_ALLOC_WAIT(e,sz); + e = kzalloc(sz, GFP_KERNEL); if (unlikely( - e == NULL + !e )) S1 else S2 <|end_of_text|>
765
--- initial +++ final @@ -1,57 +1,57 @@ static int ll_readlink_internal(struct inode *inode, struct ptlrpc_request **request, char **symname) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); int rc, symlen = i_size_read(inode) + 1; struct mdt_body *body; struct md_op_data *op_data; *request = NULL; if (lli->lli_symlink_name) { int print_limit = min_t(int, PAGE_SIZE - 128, symlen); *symname = lli->lli_symlink_name; /* If the total CDEBUG() size is larger than a page, it * will print a warning to the console, avoid this by * printing just the last part of the symlink. */ CDEBUG(D_INODE, "using cached symlink %s%.*s, len = %d\n", print_limit < symlen ? "..." : "", print_limit, (*symname) + symlen - print_limit, symlen); return 0; } op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, symlen, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); op_data->op_valid = OBD_MD_LINKNAME; rc = md_getattr(sbi->ll_md_exp, op_data, request); ll_finish_md_op_data(op_data); if (rc) { if (rc != -ENOENT) CERROR("inode %lu: rc = %d\n", inode->i_ino, rc); goto failed; } body = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_BODY); LASSERT(body != NULL); if ((body->valid & OBD_MD_LINKNAME) == 0) { CERROR("OBD_MD_LINKNAME not set on reply\n"); rc = -EPROTO; goto failed; } LASSERT(symlen != 0); if (body->eadatasize != symlen) { CERROR("inode %lu: symlink length %d not expected %d\n", inode->i_ino, body->eadatasize - 1, symlen - 1); rc = -EPROTO; goto failed; } *symname = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_MD); if (*symname == NULL || strnlen(*symname, symlen) != symlen - 1) { /* not full/NULL terminated */ CERROR("inode %lu: symlink not NULL terminated string" "of length %d\n", inode->i_ino, symlen - 1); rc = -EPROTO; goto failed; } - OBD_ALLOC(lli->lli_symlink_name, symlen); + lli->lli_symlink_name = kzalloc(symlen, GFP_NOFS); /* do not return an error if we cannot cache the symlink locally */ if (lli->lli_symlink_name) { memcpy(lli->lli_symlink_name, *symname, symlen); *symname = lli->lli_symlink_name; } return 0; failed: return rc; }<sep>@@ expression e,sz; statement S1,S2; @@ - OBD_ALLOC(e,sz); + e = kzalloc(sz, GFP_NOFS); if (likely( - e != NULL + e )) S1 else S2 <|end_of_text|>
770
--- initial +++ final @@ -1,4 +1,4 @@ static int __net_init if6_proc_net_init(struct net *net) { - if (!proc_net_fops_create(net, "if_inet6", S_IRUGO, &if6_fops)) return -ENOMEM; + if (!proc_create("if_inet6", S_IRUGO, net->proc_net, &if6_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,131
--- initial +++ final @@ -1,12 +1,12 @@ static int __init ax25_init(void) { int rc = proto_register(&ax25_proto, 0); if (rc != 0) goto out; sock_register(&ax25_family_ops); dev_add_pack(&ax25_packet_type); register_netdevice_notifier(&ax25_dev_notifier); - proc_net_fops_create(&init_net, "ax25_route", S_IRUGO, &ax25_route_fops); - proc_net_fops_create(&init_net, "ax25", S_IRUGO, &ax25_info_fops); - proc_net_fops_create(&init_net, "ax25_calls", S_IRUGO, &ax25_uid_fops); + proc_create("ax25_route", S_IRUGO, init_net.proc_net, &ax25_route_fops); + proc_create("ax25", S_IRUGO, init_net.proc_net, &ax25_info_fops); + proc_create("ax25_calls", S_IRUGO, init_net.proc_net, &ax25_uid_fops); out: return rc; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,132
--- initial +++ final @@ -1,17 +1,17 @@ static int __init decnet_init(void) { int rc; printk(banner); rc = proto_register(&dn_proto, 1); if (rc != 0) goto out; dn_neigh_init(); dn_dev_init(); dn_route_init(); dn_fib_init(); sock_register(&dn_family_ops); dev_add_pack(&dn_dix_packet_type); register_netdevice_notifier(&dn_dev_notifier); - proc_net_fops_create(&init_net, "decnet", S_IRUGO, &dn_socket_seq_fops); + proc_create("decnet", S_IRUGO, init_net.proc_net, &dn_socket_seq_fops); dn_register_sysctl(); out: return rc; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,133
--- initial +++ final @@ -1,6 +1,6 @@ static int __net_init netlink_net_init(struct net *net) { #ifdef CONFIG_PROC_FS - if (!proc_net_fops_create(net, "netlink", 0, &netlink_seq_fops)) return -ENOMEM; + if (!proc_create("netlink", 0, net->proc_net, &netlink_seq_fops)) return -ENOMEM; #endif return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,134
--- initial +++ final @@ -1,57 +1,57 @@ static int __init nr_proto_init(void) { int i; int rc = proto_register(&nr_proto, 0); if (rc != 0) goto out; if (nr_ndevs > 0x7fffffff / sizeof(struct net_device *)) { printk(KERN_ERR "NET/ROM: nr_proto_init - nr_ndevs parameter to large\n"); return -1; } dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL); if (dev_nr == NULL) { printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n"); return -1; } for (i = 0; i < nr_ndevs; i++) { char name[IFNAMSIZ]; struct net_device *dev; sprintf(name, "nr%d", i); dev = alloc_netdev(0, name, nr_setup); if (!dev) { printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); goto fail; } dev->base_addr = i; if (register_netdev(dev)) { printk(KERN_ERR "NET/ROM: nr_proto_init - unable to register network device\n"); free_netdev(dev); goto fail; } nr_set_lockdep_key(dev); dev_nr[i] = dev; } if (sock_register(&nr_family_ops)) { printk(KERN_ERR "NET/ROM: nr_proto_init - unable to register socket family\n"); goto fail; } register_netdevice_notifier(&nr_dev_notifier); ax25_register_pid(&nr_pid); ax25_linkfail_register(&nr_linkfail_notifier); #ifdef CONFIG_SYSCTL nr_register_sysctl(); #endif nr_loopback_init(); - proc_net_fops_create(&init_net, "nr", S_IRUGO, &nr_info_fops); - proc_net_fops_create(&init_net, "nr_neigh", S_IRUGO, &nr_neigh_fops); - proc_net_fops_create(&init_net, "nr_nodes", S_IRUGO, &nr_nodes_fops); + proc_create("nr", S_IRUGO, init_net.proc_net, &nr_info_fops); + proc_create("nr_neigh", S_IRUGO, init_net.proc_net, &nr_neigh_fops); + proc_create("nr_nodes", S_IRUGO, init_net.proc_net, &nr_nodes_fops); out: return rc; fail: while (--i >= 0) { unregister_netdev(dev_nr[i]); free_netdev(dev_nr[i]); } kfree(dev_nr); proto_unregister(&nr_proto); rc = -1; goto out; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,135
--- initial +++ final @@ -1,6 +1,6 @@ static int __net_init packet_net_init(struct net *net) { mutex_init(&net->packet.sklist_lock); INIT_HLIST_HEAD(&net->packet.sklist); - if (!proc_net_fops_create(net, "packet", 0, &packet_seq_fops)) return -ENOMEM; + if (!proc_create("packet", 0, net->proc_net, &packet_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,136
--- initial +++ final @@ -1,61 +1,61 @@ static int __init rose_proto_init(void) { int i; int rc; if (rose_ndevs > 0x7FFFFFFF / sizeof(struct net_device *)) { printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); rc = -EINVAL; goto out; } rc = proto_register(&rose_proto, 0); if (rc != 0) goto out; rose_callsign = null_ax25_address; dev_rose = kzalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); if (dev_rose == NULL) { printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); rc = -ENOMEM; goto out_proto_unregister; } for (i = 0; i < rose_ndevs; i++) { struct net_device *dev; char name[IFNAMSIZ]; sprintf(name, "rose%d", i); dev = alloc_netdev(0, name, rose_setup); if (!dev) { printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n"); rc = -ENOMEM; goto fail; } rc = register_netdev(dev); if (rc) { printk(KERN_ERR "ROSE: netdevice registration failed\n"); free_netdev(dev); goto fail; } rose_set_lockdep_key(dev); dev_rose[i] = dev; } sock_register(&rose_family_ops); register_netdevice_notifier(&rose_dev_notifier); ax25_register_pid(&rose_pid); ax25_linkfail_register(&rose_linkfail_notifier); #ifdef CONFIG_SYSCTL rose_register_sysctl(); #endif rose_loopback_init(); rose_add_loopback_neigh(); - proc_net_fops_create(&init_net, "rose", S_IRUGO, &rose_info_fops); - proc_net_fops_create(&init_net, "rose_neigh", S_IRUGO, &rose_neigh_fops); - proc_net_fops_create(&init_net, "rose_nodes", S_IRUGO, &rose_nodes_fops); - proc_net_fops_create(&init_net, "rose_routes", S_IRUGO, &rose_routes_fops); + proc_create("rose", S_IRUGO, init_net.proc_net, &rose_info_fops); + proc_create("rose_neigh", S_IRUGO, init_net.proc_net, &rose_neigh_fops); + proc_create("rose_nodes", S_IRUGO, init_net.proc_net, &rose_nodes_fops); + proc_create("rose_routes", S_IRUGO, init_net.proc_net, &rose_routes_fops); out: return rc; fail: while (--i >= 0) { unregister_netdev(dev_rose[i]); free_netdev(dev_rose[i]); } kfree(dev_rose); out_proto_unregister: proto_unregister(&rose_proto); goto out; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,137
--- initial +++ final @@ -1,53 +1,53 @@ static int __init af_rxrpc_init(void) { int ret = -1; BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > FIELD_SIZEOF(struct sk_buff, cb)); rxrpc_epoch = htonl(get_seconds()); ret = -ENOMEM; rxrpc_call_jar = kmem_cache_create("rxrpc_call_jar", sizeof(struct rxrpc_call), 0, SLAB_HWCACHE_ALIGN, NULL); if (!rxrpc_call_jar) { printk(KERN_NOTICE "RxRPC: Failed to allocate call jar\n"); goto error_call_jar; } rxrpc_workqueue = alloc_workqueue("krxrpcd", 0, 1); if (!rxrpc_workqueue) { printk(KERN_NOTICE "RxRPC: Failed to allocate work queue\n"); goto error_work_queue; } ret = proto_register(&rxrpc_proto, 1); if (ret < 0) { printk(KERN_CRIT "RxRPC: Cannot register protocol\n"); goto error_proto; } ret = sock_register(&rxrpc_family_ops); if (ret < 0) { printk(KERN_CRIT "RxRPC: Cannot register socket family\n"); goto error_sock; } ret = register_key_type(&key_type_rxrpc); if (ret < 0) { printk(KERN_CRIT "RxRPC: Cannot register client key type\n"); goto error_key_type; } ret = register_key_type(&key_type_rxrpc_s); if (ret < 0) { printk(KERN_CRIT "RxRPC: Cannot register server key type\n"); goto error_key_type_s; } #ifdef CONFIG_PROC_FS - proc_net_fops_create(&init_net, "rxrpc_calls", 0, &rxrpc_call_seq_fops); - proc_net_fops_create(&init_net, "rxrpc_conns", 0, &rxrpc_connection_seq_fops); + proc_create("rxrpc_calls", 0, init_net.proc_net, &rxrpc_call_seq_fops); + proc_create("rxrpc_conns", 0, init_net.proc_net, &rxrpc_connection_seq_fops); #endif return 0; error_key_type_s: unregister_key_type(&key_type_rxrpc); error_key_type: sock_unregister(PF_RXRPC); error_sock: proto_unregister(&rxrpc_proto); error_proto: destroy_workqueue(rxrpc_workqueue); error_work_queue: kmem_cache_destroy(rxrpc_call_jar); error_call_jar: return ret; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,138
--- initial +++ final @@ -1,14 +1,14 @@ static int __net_init unix_net_init(struct net *net) { int error = -ENOMEM; net->unx.sysctl_max_dgram_qlen = 10; if (unix_sysctl_register(net)) goto out; #ifdef CONFIG_PROC_FS - if (!proc_net_fops_create(net, "unix", 0, &unix_seq_fops)) { + if (!proc_create("unix", 0, net->proc_net, &unix_seq_fops)) { unix_sysctl_unregister(net); goto out; } #endif error = 0; out: return error; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,139
--- initial +++ final @@ -1,4 +1,4 @@ int __net_init ac6_proc_init(struct net *net) { - if (!proc_net_fops_create(net, "anycast6", S_IRUGO, &ac6_seq_fops)) return -ENOMEM; + if (!proc_create("anycast6", S_IRUGO, net->proc_net, &ac6_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,140
--- initial +++ final @@ -1,4 +1,4 @@ static int __net_init arp_net_init(struct net *net) { - if (!proc_net_fops_create(net, "arp", S_IRUGO, &arp_seq_fops)) return -ENOMEM; + if (!proc_create("arp", S_IRUGO, net->proc_net, &arp_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,141
--- initial +++ final @@ -1,12 +1,12 @@ static int __init bpq_init_driver(void) { #ifdef CONFIG_PROC_FS - if (!proc_net_fops_create(&init_net, "bpqether", S_IRUGO, &bpq_info_fops)) { + if (!proc_create("bpqether", S_IRUGO, init_net.proc_net, &bpq_info_fops)) { printk(KERN_ERR "bpq: cannot create /proc/net/bpqether entry.\n"); return -ENOENT; } #endif /* CONFIG_PROC_FS */ dev_add_pack(&bpq_packet_type); register_netdevice_notifier(&bpq_dev_notifier); printk(banner); return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,142
--- initial +++ final @@ -1,17 +1,17 @@ static int cn_init(void) { struct cn_dev *dev = &cdev; struct netlink_kernel_cfg cfg = { .groups = CN_NETLINK_USERS + 0xf, .input = dev->input, }; dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, &cfg); if (!dev->nls) return -EIO; dev->cbdev = cn_queue_alloc_dev("cqueue", dev->nls); if (!dev->cbdev) { netlink_kernel_release(dev->nls); return -EINVAL; } cn_already_initialized = 1; - proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops); + proc_create("connector", S_IRUGO, init_net.proc_net, &cn_file_ops); return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,143
--- initial +++ final @@ -1,16 +1,16 @@ static __init int dccpprobe_init(void) { int ret = -ENOMEM; init_waitqueue_head(&dccpw.wait); spin_lock_init(&dccpw.lock); if (kfifo_alloc(&dccpw.fifo, bufsize, GFP_KERNEL)) return ret; - if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) goto err0; + if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops)) goto err0; ret = setup_jprobe(); if (ret) goto err1; pr_info("DCCP watch registered (port=%d)\n", port); return 0; err1: proc_net_remove(&init_net, procname); err0: kfifo_free(&dccpw.fifo); return ret; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,144
--- initial +++ final @@ -1,4 +1,4 @@ static int __net_init dev_mc_net_init(struct net *net) { - if (!proc_net_fops_create(net, "dev_mcast", 0, &dev_mc_seq_fops)) return -ENOMEM; + if (!proc_create("dev_mcast", 0, net->proc_net, &dev_mc_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,145
--- initial +++ final @@ -1,17 +1,17 @@ static int __net_init dev_proc_net_init(struct net *net) { int rc = -ENOMEM; - if (!proc_net_fops_create(net, "dev", S_IRUGO, &dev_seq_fops)) goto out; - if (!proc_net_fops_create(net, "softnet_stat", S_IRUGO, &softnet_seq_fops)) goto out_dev; - if (!proc_net_fops_create(net, "ptype", S_IRUGO, &ptype_seq_fops)) goto out_softnet; + if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops)) goto out; + if (!proc_create("softnet_stat", S_IRUGO, net->proc_net, &softnet_seq_fops)) goto out_dev; + if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) goto out_softnet; if (wext_proc_init(net)) goto out_ptype; rc = 0; out: return rc; out_ptype: proc_net_remove(net, "ptype"); out_softnet: proc_net_remove(net, "softnet_stat"); out_dev: proc_net_remove(net, "dev"); goto out; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,146
--- initial +++ final @@ -1,23 +1,23 @@ void __init dn_dev_init(void) { if (addr[0] > 63 || addr[0] < 0) { printk(KERN_ERR "DECnet: Area must be between 0 and 63"); return; } if (addr[1] > 1023 || addr[1] < 0) { printk(KERN_ERR "DECnet: Node must be between 0 and 1023"); return; } decnet_address = cpu_to_le16((addr[0] << 10) | addr[1]); dn_dev_devices_on(); rtnl_register(PF_DECnet, RTM_NEWADDR, dn_nl_newaddr, NULL, NULL); rtnl_register(PF_DECnet, RTM_DELADDR, dn_nl_deladdr, NULL, NULL); rtnl_register(PF_DECnet, RTM_GETADDR, NULL, dn_nl_dump_ifaddr, NULL); - proc_net_fops_create(&init_net, "decnet_dev", S_IRUGO, &dn_dev_seq_fops); + proc_create("decnet_dev", S_IRUGO, init_net.proc_net, &dn_dev_seq_fops); #ifdef CONFIG_SYSCTL { int i; for (i = 0; i < DN_DEV_LIST_SIZE; i++) dn_dev_sysctl_register(NULL, &dn_dev_list[i]); } #endif /* CONFIG_SYSCTL */ }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,147
--- initial +++ final @@ -1,4 +1,4 @@ void __init dn_neigh_init(void) { neigh_table_init(&dn_neigh_table); - proc_net_fops_create(&init_net, "decnet_neigh", S_IRUGO, &dn_neigh_seq_fops); + proc_create("decnet_neigh", S_IRUGO, init_net.proc_net, &dn_neigh_seq_fops); }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,148
--- initial +++ final @@ -1,37 +1,37 @@ void __init dn_route_init(void) { int i, goal, order; dn_dst_ops.kmem_cachep = kmem_cache_create("dn_dst_cache", sizeof(struct dn_route), 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); dst_entries_init(&dn_dst_ops); setup_timer(&dn_route_timer, dn_dst_check_expire, 0); dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ; add_timer(&dn_route_timer); goal = totalram_pages >> (26 - PAGE_SHIFT); for (order = 0; (1UL << order) < goal; order++) /* NOTHING */; /* * Only want 1024 entries max, since the table is very, very unlikely * to be larger than that. */ while (order && ((((1UL << order) * PAGE_SIZE) / sizeof(struct dn_rt_hash_bucket)) >= 2048)) order--; do { dn_rt_hash_mask = (1UL << order) * PAGE_SIZE / sizeof(struct dn_rt_hash_bucket); while (dn_rt_hash_mask & (dn_rt_hash_mask - 1)) dn_rt_hash_mask--; dn_rt_hash_table = (struct dn_rt_hash_bucket *)__get_free_pages(GFP_ATOMIC, order); } while (dn_rt_hash_table == NULL && --order > 0); if (!dn_rt_hash_table) panic("Failed to allocate DECnet route cache hash table\n"); printk(KERN_INFO "DECnet: Routing cache hash table of %u buckets, %ldKbytes\n", dn_rt_hash_mask, (long)(dn_rt_hash_mask * sizeof(struct dn_rt_hash_bucket)) / 1024); dn_rt_hash_mask--; for (i = 0; i <= dn_rt_hash_mask; i++) { spin_lock_init(&dn_rt_hash_table[i].lock); dn_rt_hash_table[i].chain = NULL; } dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1); - proc_net_fops_create(&init_net, "decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops); + proc_create("decnet_cache", S_IRUGO, init_net.proc_net, &dn_rt_cache_seq_fops); #ifdef CONFIG_DECNET_ROUTER rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_fib_dump, NULL); #else rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_cache_dump, NULL); #endif }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,149
--- initial +++ final @@ -1,12 +1,12 @@ int __net_init fib_proc_init(struct net *net) { - if (!proc_net_fops_create(net, "fib_trie", S_IRUGO, &fib_trie_fops)) goto out1; - if (!proc_net_fops_create(net, "fib_triestat", S_IRUGO, &fib_triestat_fops)) goto out2; - if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_route_fops)) goto out3; + if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) goto out1; + if (!proc_create("fib_triestat", S_IRUGO, net->proc_net, &fib_triestat_fops)) goto out2; + if (!proc_create("route", S_IRUGO, net->proc_net, &fib_route_fops)) goto out3; return 0; out3: proc_net_remove(net, "fib_triestat"); out2: proc_net_remove(net, "fib_trie"); out1: return -ENOMEM; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,150
--- initial +++ final @@ -1,12 +1,12 @@ static int __net_init igmp_net_init(struct net *net) { struct proc_dir_entry *pde; - pde = proc_net_fops_create(net, "igmp", S_IRUGO, &igmp_mc_seq_fops); + pde = proc_create("igmp", S_IRUGO, net->proc_net, &igmp_mc_seq_fops); if (!pde) goto out_igmp; - pde = proc_net_fops_create(net, "mcfilter", S_IRUGO, &igmp_mcf_seq_fops); + pde = proc_create("mcfilter", S_IRUGO, net->proc_net, &igmp_mcf_seq_fops); if (!pde) goto out_mcfilter; return 0; out_mcfilter: proc_net_remove(net, "igmp"); out_igmp: return -ENOMEM; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,151
--- initial +++ final @@ -1,19 +1,19 @@ static int __net_init ip6mr_net_init(struct net *net) { int err; err = ip6mr_rules_init(net); if (err < 0) goto fail; #ifdef CONFIG_PROC_FS err = -ENOMEM; - if (!proc_net_fops_create(net, "ip6_mr_vif", 0, &ip6mr_vif_fops)) goto proc_vif_fail; - if (!proc_net_fops_create(net, "ip6_mr_cache", 0, &ip6mr_mfc_fops)) goto proc_cache_fail; + if (!proc_create("ip6_mr_vif", 0, net->proc_net, &ip6mr_vif_fops)) goto proc_vif_fail; + if (!proc_create("ip6_mr_cache", 0, net->proc_net, &ip6mr_mfc_fops)) goto proc_cache_fail; #endif return 0; #ifdef CONFIG_PROC_FS proc_cache_fail: proc_net_remove(net, "ip6_mr_vif"); proc_vif_fail: ip6mr_rules_exit(net); #endif fail: return err; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,152
--- initial +++ final @@ -1,6 +1,6 @@ int __net_init ip_vs_app_net_init(struct net *net) { struct netns_ipvs *ipvs = net_ipvs(net); INIT_LIST_HEAD(&ipvs->app_list); - proc_net_fops_create(net, "ip_vs_app", 0, &ip_vs_app_fops); + proc_create("ip_vs_app", 0, net->proc_net, &ip_vs_app_fops); return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,153
--- initial +++ final @@ -1,7 +1,7 @@ int __net_init ip_vs_conn_net_init(struct net *net) { struct netns_ipvs *ipvs = net_ipvs(net); atomic_set(&ipvs->conn_count, 0); - proc_net_fops_create(net, "ip_vs_conn", 0, &ip_vs_conn_fops); - proc_net_fops_create(net, "ip_vs_conn_sync", 0, &ip_vs_conn_sync_fops); + proc_create("ip_vs_conn", 0, net->proc_net, &ip_vs_conn_fops); + proc_create("ip_vs_conn_sync", 0, net->proc_net, &ip_vs_conn_sync_fops); return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,154
--- initial +++ final @@ -1,23 +1,23 @@ int __net_init ip_vs_control_net_init(struct net *net) { int idx; struct netns_ipvs *ipvs = net_ipvs(net); rwlock_init(&ipvs->rs_lock); /* Initialize rs_table */ for (idx = 0; idx < IP_VS_RTAB_SIZE; idx++) INIT_LIST_HEAD(&ipvs->rs_table[idx]); INIT_LIST_HEAD(&ipvs->dest_trash); atomic_set(&ipvs->ftpsvc_counter, 0); atomic_set(&ipvs->nullsvc_counter, 0); /* procfs stats */ ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); if (!ipvs->tot_stats.cpustats) return -ENOMEM; spin_lock_init(&ipvs->tot_stats.lock); - proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops); - proc_net_fops_create(net, "ip_vs_stats", 0, &ip_vs_stats_fops); - proc_net_fops_create(net, "ip_vs_stats_percpu", 0, &ip_vs_stats_percpu_fops); + proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops); + proc_create("ip_vs_stats", 0, net->proc_net, &ip_vs_stats_fops); + proc_create("ip_vs_stats_percpu", 0, net->proc_net, &ip_vs_stats_percpu_fops); if (ip_vs_control_net_init_sysctl(net)) goto err; return 0; err: free_percpu(ipvs->tot_stats.cpustats); return -ENOMEM; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,155
--- initial +++ final @@ -1,111 +1,111 @@ static int __init ip_auto_config(void) { __be32 addr; #ifdef IPCONFIG_DYNAMIC int retries = CONF_OPEN_RETRIES; #endif int err; unsigned int i; #ifdef CONFIG_PROC_FS - proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops); + proc_create("pnp", S_IRUGO, init_net.proc_net, &pnp_seq_fops); #endif /* CONFIG_PROC_FS */ if (!ic_enable) return 0; DBG(("IP-Config: Entered.\n")); #ifdef IPCONFIG_DYNAMIC try_try_again: #endif /* Wait for devices to appear */ err = wait_for_devices(); if (err) return err; /* Setup all network devices */ err = ic_open_devs(); if (err) return err; /* Give drivers a chance to settle */ msleep(CONF_POST_OPEN); /* * If the config information is insufficient (e.g., our IP address or * IP address of the boot server is missing or we have multiple network * interfaces and no default was set), use BOOTP or RARP to get the * missing values. */ if (ic_myaddr == NONE || #ifdef CONFIG_ROOT_NFS (root_server_addr == NONE && ic_servaddr == NONE && ROOT_DEV == Root_NFS) || #endif ic_first_dev->next) { #ifdef IPCONFIG_DYNAMIC if (ic_dynamic() < 0) { ic_close_devs(); /* * I don't know why, but sometimes the * eepro100 driver (at least) gets upset and * doesn't work the first time it's opened. * But then if you close it and reopen it, it * works just fine. So we need to try that at * least once before giving up. * * Also, if the root will be NFS-mounted, we * have nowhere to go if DHCP fails. So we * just have to keep trying forever. * * -- Chip */ #ifdef CONFIG_ROOT_NFS if (ROOT_DEV == Root_NFS) { pr_err("IP-Config: Retrying forever (NFS root)...\n"); goto try_try_again; } #endif if (--retries) { pr_err("IP-Config: Reopening network devices...\n"); goto try_try_again; } /* Oh, well. At least we tried. */ pr_err("IP-Config: Auto-configuration of network failed\n"); return -1; } #else /* !DYNAMIC */ pr_err("IP-Config: Incomplete network configuration information\n"); ic_close_devs(); return -1; #endif /* IPCONFIG_DYNAMIC */ } else { /* Device selected manually or only one device -> use it */ ic_dev = ic_first_dev->dev; } addr = root_nfs_parse_addr(root_server_path); if (root_server_addr == NONE) root_server_addr = addr; /* * Use defaults wherever applicable. */ if (ic_defaults() < 0) return -1; /* * Close all network devices except the device we've * autoconfigured and set up routes. */ ic_close_devs(); if (ic_setup_if() < 0 || ic_setup_routes() < 0) return -1; /* * Record which protocol was actually used. */ #ifdef IPCONFIG_DYNAMIC ic_proto_used = ic_got_reply | (ic_proto_enabled & IC_USE_DHCP); #endif #ifndef IPCONFIG_SILENT /* * Clue in the operator. */ pr_info("IP-Config: Complete:\n"); pr_info(" device=%s, hwaddr=%*phC, ipaddr=%pI4, mask=%pI4, gw=%pI4\n", ic_dev->name, ic_dev->addr_len, ic_dev->dev_addr, &ic_myaddr, &ic_netmask, &ic_gateway); pr_info(" host=%s, domain=%s, nis-domain=%s\n", utsname()->nodename, ic_domain, utsname()->domainname); pr_info(" bootserver=%pI4, rootserver=%pI4, rootpath=%s", &ic_servaddr, &root_server_addr, root_server_path); if (ic_dev_mtu) pr_cont(", mtu=%d", ic_dev_mtu); for (i = 0; i < CONF_NAMESERVERS_MAX; i++) if (ic_nameservers[i] != NONE) { pr_info(" nameserver%u=%pI4", i, &ic_nameservers[i]); break; } for (i++; i < CONF_NAMESERVERS_MAX; i++) if (ic_nameservers[i] != NONE) pr_cont(", nameserver%u=%pI4\n", i, &ic_nameservers[i]); #endif /* !SILENT */ return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,156
--- initial +++ final @@ -1,19 +1,19 @@ static int __net_init ipmr_net_init(struct net *net) { int err; err = ipmr_rules_init(net); if (err < 0) goto fail; #ifdef CONFIG_PROC_FS err = -ENOMEM; - if (!proc_net_fops_create(net, "ip_mr_vif", 0, &ipmr_vif_fops)) goto proc_vif_fail; - if (!proc_net_fops_create(net, "ip_mr_cache", 0, &ipmr_mfc_fops)) goto proc_cache_fail; + if (!proc_create("ip_mr_vif", 0, net->proc_net, &ipmr_vif_fops)) goto proc_vif_fail; + if (!proc_create("ip_mr_cache", 0, net->proc_net, &ipmr_mfc_fops)) goto proc_cache_fail; #endif return 0; #ifdef CONFIG_PROC_FS proc_cache_fail: proc_net_remove(net, "ip_mr_vif"); proc_vif_fail: ipmr_rules_exit(net); #endif fail: return err; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,157
--- initial +++ final @@ -1,12 +1,12 @@ static __net_init int ip_proc_init_net(struct net *net) { - if (!proc_net_fops_create(net, "sockstat", S_IRUGO, &sockstat_seq_fops)) goto out_sockstat; - if (!proc_net_fops_create(net, "netstat", S_IRUGO, &netstat_seq_fops)) goto out_netstat; - if (!proc_net_fops_create(net, "snmp", S_IRUGO, &snmp_seq_fops)) goto out_snmp; + if (!proc_create("sockstat", S_IRUGO, net->proc_net, &sockstat_seq_fops)) goto out_sockstat; + if (!proc_create("netstat", S_IRUGO, net->proc_net, &netstat_seq_fops)) goto out_netstat; + if (!proc_create("snmp", S_IRUGO, net->proc_net, &snmp_seq_fops)) goto out_snmp; return 0; out_snmp: proc_net_remove(net, "netstat"); out_netstat: proc_net_remove(net, "sockstat"); out_sockstat: return -ENOMEM; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,158
--- initial +++ final @@ -1,4 +1,4 @@ static __net_init int raw_init_net(struct net *net) { - if (!proc_net_fops_create(net, "raw", S_IRUGO, &raw_seq_fops)) return -ENOMEM; + if (!proc_create("raw", S_IRUGO, net->proc_net, &raw_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,159
--- initial +++ final @@ -1,20 +1,20 @@ static int __net_init ip_rt_do_proc_init(struct net *net) { struct proc_dir_entry *pde; - pde = proc_net_fops_create(net, "rt_cache", S_IRUGO, &rt_cache_seq_fops); + pde = proc_create("rt_cache", S_IRUGO, net->proc_net, &rt_cache_seq_fops); if (!pde) goto err1; pde = proc_create("rt_cache", S_IRUGO, net->proc_net_stat, &rt_cpu_seq_fops); if (!pde) goto err2; #ifdef CONFIG_IP_ROUTE_CLASSID pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops); if (!pde) goto err3; #endif return 0; #ifdef CONFIG_IP_ROUTE_CLASSID err3: remove_proc_entry("rt_cache", net->proc_net_stat); #endif err2: remove_proc_entry("rt_cache", net->proc_net); err1: return -ENOMEM; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,160
--- initial +++ final @@ -1,11 +1,11 @@ static __net_init int pppol2tp_init_net(struct net *net) { struct proc_dir_entry *pde; int err = 0; - pde = proc_net_fops_create(net, "pppol2tp", S_IRUGO, &pppol2tp_proc_fops); + pde = proc_create("pppol2tp", S_IRUGO, net->proc_net, &pppol2tp_proc_fops); if (!pde) { err = -ENOMEM; goto out; } out: return err; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,161
--- initial +++ final @@ -1,8 +1,8 @@ static int exp_proc_init(struct net *net) { #ifdef CONFIG_NF_CONNTRACK_PROCFS struct proc_dir_entry *proc; - proc = proc_net_fops_create(net, "nf_conntrack_expect", 0440, &exp_file_ops); + proc = proc_create("nf_conntrack_expect", 0440, net->proc_net, &exp_file_ops); if (!proc) return -ENOMEM; #endif /* CONFIG_NF_CONNTRACK_PROCFS */ return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,162
--- initial +++ final @@ -1,16 +1,16 @@ static int __net_init ip_conntrack_net_init(struct net *net) { struct proc_dir_entry *proc, *proc_exp, *proc_stat; - proc = proc_net_fops_create(net, "ip_conntrack", 0440, &ct_file_ops); + proc = proc_create("ip_conntrack", 0440, net->proc_net, &ct_file_ops); if (!proc) goto err1; - proc_exp = proc_net_fops_create(net, "ip_conntrack_expect", 0440, &ip_exp_file_ops); + proc_exp = proc_create("ip_conntrack_expect", 0440, net->proc_net, &ip_exp_file_ops); if (!proc_exp) goto err2; proc_stat = proc_create("ip_conntrack", S_IRUGO, net->proc_net_stat, &ct_cpu_seq_fops); if (!proc_stat) goto err3; return 0; err3: proc_net_remove(net, "ip_conntrack_expect"); err2: proc_net_remove(net, "ip_conntrack"); err1: return -ENOMEM; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,163
--- initial +++ final @@ -1,7 +1,7 @@ static int ping_proc_register(struct net *net) { struct proc_dir_entry *p; int rc = 0; - p = proc_net_fops_create(net, "icmp", S_IRUGO, &ping_seq_fops); + p = proc_create("icmp", S_IRUGO, net->proc_net, &ping_seq_fops); if (!p) rc = -ENOMEM; return rc; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,164
--- initial +++ final @@ -1,9 +1,9 @@ int __init phonet_device_init(void) { int err = register_pernet_subsys(&phonet_net_ops); if (err) return err; - proc_net_fops_create(&init_net, "pnresource", 0, &pn_res_seq_fops); + proc_create("pnresource", 0, init_net.proc_net, &pn_res_seq_fops); register_netdevice_notifier(&phonet_device_notifier); err = phonet_netlink_register(); if (err) phonet_device_exit(); return err; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,165
--- initial +++ final @@ -1,8 +1,8 @@ static int __net_init phonet_init_net(struct net *net) { struct phonet_net *pnn = phonet_pernet(net); - if (!proc_net_fops_create(net, "phonet", 0, &pn_sock_seq_fops)) return -ENOMEM; + if (!proc_create("phonet", 0, net->proc_net, &pn_sock_seq_fops)) return -ENOMEM; INIT_LIST_HEAD(&pnn->pndevs.list); mutex_init(&pnn->pndevs.lock); mutex_init(&pnn->routes.lock); return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,166
--- initial +++ final @@ -1,10 +1,10 @@ static __net_init int pppoe_init_net(struct net *net) { struct pppoe_net *pn = pppoe_pernet(net); struct proc_dir_entry *pde; rwlock_init(&pn->hash_lock); - pde = proc_net_fops_create(net, "pppoe", S_IRUGO, &pppoe_seq_fops); + pde = proc_create("pppoe", S_IRUGO, net->proc_net, &pppoe_seq_fops); #ifdef CONFIG_PROC_FS if (!pde) return -ENOMEM; #endif return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,167
--- initial +++ final @@ -1,21 +1,21 @@ static __init int sctpprobe_init(void) { int ret = -ENOMEM; /* Warning: if the function signature of sctp_sf_eat_sack_6_2, * has been changed, you also have to change the signature of * jsctp_sf_eat_sack, otherwise you end up right here! */ BUILD_BUG_ON(__same_type(sctp_sf_eat_sack_6_2, jsctp_sf_eat_sack) == 0); init_waitqueue_head(&sctpw.wait); spin_lock_init(&sctpw.lock); if (kfifo_alloc(&sctpw.fifo, bufsize, GFP_KERNEL)) return ret; - if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &sctpprobe_fops)) goto free_kfifo; + if (!proc_create(procname, S_IRUSR, init_net.proc_net, &sctpprobe_fops)) goto free_kfifo; ret = register_jprobe(&sctp_recv_probe); if (ret) goto remove_proc; pr_info("probe registered (port=%d)\n", port); return 0; remove_proc: proc_net_remove(&init_net, procname); free_kfifo: kfifo_free(&sctpw.fifo); return ret; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,168
--- initial +++ final @@ -1,12 +1,12 @@ static int __net_init ipv6_proc_init_net(struct net *net) { - if (!proc_net_fops_create(net, "sockstat6", S_IRUGO, &sockstat6_seq_fops)) return -ENOMEM; - if (!proc_net_fops_create(net, "snmp6", S_IRUGO, &snmp6_seq_fops)) goto proc_snmp6_fail; + if (!proc_create("sockstat6", S_IRUGO, net->proc_net, &sockstat6_seq_fops)) return -ENOMEM; + if (!proc_create("snmp6", S_IRUGO, net->proc_net, &snmp6_seq_fops)) goto proc_snmp6_fail; net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net); if (!net->mib.proc_net_devsnmp6) goto proc_dev_snmp6_fail; return 0; proc_dev_snmp6_fail: proc_net_remove(net, "snmp6"); proc_snmp6_fail: proc_net_remove(net, "sockstat6"); return -ENOMEM; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,169
--- initial +++ final @@ -1,4 +1,4 @@ static int __net_init raw6_init_net(struct net *net) { - if (!proc_net_fops_create(net, "raw6", S_IRUGO, &raw6_seq_fops)) return -ENOMEM; + if (!proc_create("raw6", S_IRUGO, net->proc_net, &raw6_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,170
--- initial +++ final @@ -1,7 +1,7 @@ static int __net_init ip6_route_net_init_late(struct net *net) { #ifdef CONFIG_PROC_FS - proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops); - proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); + proc_create("ipv6_route", 0, net->proc_net, &ipv6_route_proc_fops); + proc_create("rt6_stats", S_IRUGO, net->proc_net, &rt6_stats_seq_fops); #endif return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,171
--- initial +++ final @@ -1,17 +1,17 @@ static int __init scc_init_driver(void) { char devname[IFNAMSIZ]; printk(banner); sprintf(devname, "%s0", SCC_DriverName); rtnl_lock(); if (scc_net_alloc(devname, SCC_Info)) { rtnl_unlock(); printk(KERN_ERR "z8530drv: cannot initialize module\n"); return -EIO; } rtnl_unlock(); - proc_net_fops_create(&init_net, "z8530drv", 0, &scc_net_seq_fops); + proc_create("z8530drv", 0, init_net.proc_net, &scc_net_seq_fops); return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,172
--- initial +++ final @@ -1,4 +1,4 @@ static __net_init int proto_init_net(struct net *net) { - if (!proc_net_fops_create(net, "protocols", S_IRUGO, &proto_seq_fops)) return -ENOMEM; + if (!proc_create("protocols", S_IRUGO, net->proc_net, &proto_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,173
--- initial +++ final @@ -1,19 +1,19 @@ static __init int tcpprobe_init(void) { int ret = -ENOMEM; init_waitqueue_head(&tcp_probe.wait); spin_lock_init(&tcp_probe.lock); if (bufsize == 0) return -EINVAL; bufsize = roundup_pow_of_two(bufsize); tcp_probe.log = kcalloc(bufsize, sizeof(struct tcp_log), GFP_KERNEL); if (!tcp_probe.log) goto err0; - if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &tcpprobe_fops)) goto err0; + if (!proc_create(procname, S_IRUSR, init_net.proc_net, &tcpprobe_fops)) goto err0; ret = register_jprobe(&tcp_jprobe); if (ret) goto err1; pr_info("probe registered (port=%d) bufsize=%u\n", port, bufsize); return 0; err1: proc_net_remove(&init_net, procname); err0: kfree(tcp_probe.log); return ret; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,174
--- initial +++ final @@ -1,5 +1,5 @@ int __net_init wext_proc_init(struct net *net) { /* Create /proc/net/wireless entry */ - if (!proc_net_fops_create(net, "wireless", S_IRUGO, &wireless_seq_fops)) return -ENOMEM; + if (!proc_create("wireless", S_IRUGO, net->proc_net, &wireless_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,175
--- initial +++ final @@ -1,4 +1,4 @@ int __net_init xfrm_proc_init(struct net *net) { - if (!proc_net_fops_create(net, "xfrm_stat", S_IRUGO, &xfrm_statistics_seq_fops)) return -ENOMEM; + if (!proc_create("xfrm_stat", S_IRUGO, net->proc_net, &xfrm_statistics_seq_fops)) return -ENOMEM; return 0; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(net, e1, e2, e3) + proc_create(e1, e2, net->proc_net, e3) <|end_of_text|>
1,176
--- initial +++ final @@ -1,34 +1,34 @@ static int __init yam_init_driver(void) { struct net_device *dev; int i, err; char name[IFNAMSIZ]; printk(yam_drvinfo); for (i = 0; i < NR_PORTS; i++) { sprintf(name, "yam%d", i); dev = alloc_netdev(sizeof(struct yam_port), name, yam_setup); if (!dev) { pr_err("yam: cannot allocate net device\n"); err = -ENOMEM; goto error; } err = register_netdev(dev); if (err) { printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name); goto error; } yam_devs[i] = dev; } yam_timer.function = yam_dotimer; yam_timer.expires = jiffies + HZ / 100; add_timer(&yam_timer); - proc_net_fops_create(&init_net, "yam", S_IRUGO, &yam_info_fops); + proc_create("yam", S_IRUGO, init_net.proc_net, &yam_info_fops); return 0; error: while (--i >= 0) { unregister_netdev(yam_devs[i]); free_netdev(yam_devs[i]); } return err; }<sep>@@ expression net,e1,e2,e3; @@ - proc_net_fops_create(&net, e1, e2, e3) + proc_create(e1, e2, net.proc_net, e3) <|end_of_text|>
1,177
--- initial +++ final @@ -1,16 +1,15 @@ static int set_tcb_field(struct adapter *adap, struct filter_entry *f, unsigned int ftid, u16 word, u64 mask, u64 val, int no_reply) { struct cpl_set_tcb_field *req; struct sk_buff *skb; skb = alloc_skb(sizeof(struct cpl_set_tcb_field), GFP_ATOMIC); if (!skb) return -ENOMEM; - req = (struct cpl_set_tcb_field *)__skb_put(skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); + req = (struct cpl_set_tcb_field *)__skb_put_zero(skb, sizeof(*req)); INIT_TP_WR_CPL(req, CPL_SET_TCB_FIELD, ftid); req->reply_ctrl = htons(REPLY_CHAN_V(0) | QUEUENO_V(adap->sge.fw_evtq.abs_id) | NO_REPLY_V(no_reply)); req->word_cookie = htons(TCB_WORD_V(word) | TCB_COOKIE_V(ftid)); req->mask = cpu_to_be64(mask); req->val = cpu_to_be64(val); set_wr_txq(skb, CPL_PRIORITY_CONTROL, f->fs.val.iport & 0x3); t4_ofld_send(adap, skb); return 0; }<sep>@@ expression skb,len,req; type T; @@ req = (T) - __skb_put + __skb_put_zero (skb, len); ... - memset(req, 0, len); <|end_of_text|>
1,250
--- initial +++ final @@ -1,29 +1,28 @@ int cxgb4_get_srq_entry(struct net_device *dev, int srq_idx, struct srq_entry *entryp) { struct cpl_srq_table_req *req; struct adapter *adap; struct sk_buff *skb; struct srq_data *s; int rc = -ENODEV; adap = netdev2adap(dev); s = adap->srq; if (!(adap->flags & FULL_INIT_DONE) || !s) goto out; skb = alloc_skb(sizeof(*req), GFP_KERNEL); if (!skb) return -ENOMEM; - req = (struct cpl_srq_table_req *)__skb_put(skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); + req = (struct cpl_srq_table_req *)__skb_put_zero(skb, sizeof(*req)); INIT_TP_WR(req, 0); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SRQ_TABLE_REQ, TID_TID_V(srq_idx) | TID_QID_V(adap->sge.fw_evtq.abs_id))); req->idx = srq_idx; mutex_lock(&s->lock); s->entryp = entryp; t4_mgmt_tx(adap, skb); rc = wait_for_completion_timeout(&s->comp, SRQ_WAIT_TO); if (rc) rc = 0; else /* !rc means we timed out */ rc = -ETIMEDOUT; WARN_ON_ONCE(entryp->idx != srq_idx); mutex_unlock(&s->lock); out: return rc; }<sep>@@ expression skb,len,req; type T; @@ req = (T) - __skb_put + __skb_put_zero (skb, len); ... - memset(req, 0, len); <|end_of_text|>
1,251
--- initial +++ final @@ -1,22 +1,21 @@ static void post_terminate(struct c4iw_qp *qhp, struct t4_cqe *err_cqe, gfp_t gfp) { struct fw_ri_wr *wqe; struct sk_buff *skb; struct terminate_message *term; pr_debug("qhp %p qid 0x%x tid %u\n", qhp, qhp->wq.sq.qid, qhp->ep->hwtid); skb = skb_dequeue(&qhp->ep->com.ep_skb_list); if (WARN_ON(!skb)) return; set_wr_txq(skb, CPL_PRIORITY_DATA, qhp->ep->txq_idx); - wqe = __skb_put(skb, sizeof(*wqe)); - memset(wqe, 0, sizeof *wqe); + wqe = __skb_put_zero(skb, sizeof(*wqe)); wqe->op_compl = cpu_to_be32(FW_WR_OP_V(FW_RI_INIT_WR)); wqe->flowid_len16 = cpu_to_be32(FW_WR_FLOWID_V(qhp->ep->hwtid) | FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*wqe), 16))); wqe->u.terminate.type = FW_RI_TYPE_TERMINATE; wqe->u.terminate.immdlen = cpu_to_be32(sizeof *term); term = (struct terminate_message *)wqe->u.terminate.termmsg; if (qhp->attr.layer_etype == (LAYER_MPA | DDP_LLP)) { term->layer_etype = qhp->attr.layer_etype; term->ecode = qhp->attr.ecode; } else build_term_codes(err_cqe, &term->layer_etype, &term->ecode); c4iw_ofld_send(&qhp->rhp->rdev, skb); }<sep>@@ expression skb,req; type T; @@ req = (T) - __skb_put + __skb_put_zero (skb, sizeof(*req)); ... - memset(req, 0, sizeof *req); <|end_of_text|>
1,252
--- initial +++ final @@ -1,18 +1,17 @@ static int rdma_fini(struct c4iw_dev *rhp, struct c4iw_qp *qhp, struct c4iw_ep *ep) { struct fw_ri_wr *wqe; int ret; struct sk_buff *skb; pr_debug("qhp %p qid 0x%x tid %u\n", qhp, qhp->wq.sq.qid, ep->hwtid); skb = skb_dequeue(&ep->com.ep_skb_list); if (WARN_ON(!skb)) return -ENOMEM; set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); - wqe = __skb_put(skb, sizeof(*wqe)); - memset(wqe, 0, sizeof *wqe); + wqe = __skb_put_zero(skb, sizeof(*wqe)); wqe->op_compl = cpu_to_be32(FW_WR_OP_V(FW_RI_INIT_WR) | FW_WR_COMPL_F); wqe->flowid_len16 = cpu_to_be32(FW_WR_FLOWID_V(ep->hwtid) | FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*wqe), 16))); wqe->cookie = (uintptr_t)ep->com.wr_waitp; wqe->u.fini.type = FW_RI_TYPE_FINI; ret = c4iw_ref_send_wait(&rhp->rdev, skb, ep->com.wr_waitp, qhp->ep->hwtid, qhp->wq.sq.qid, __func__); pr_debug("ret %d\n", ret); return ret; }<sep>@@ expression skb,req; type T; @@ req = (T) - __skb_put + __skb_put_zero (skb, sizeof(*req)); ... - memset(req, 0, sizeof *req); <|end_of_text|>
1,253
--- initial +++ final @@ -1,51 +1,50 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw_qp *qhp) { struct fw_ri_wr *wqe; int ret; struct sk_buff *skb; pr_debug("qhp %p qid 0x%x tid %u ird %u ord %u\n", qhp, qhp->wq.sq.qid, qhp->ep->hwtid, qhp->ep->ird, qhp->ep->ord); skb = alloc_skb(sizeof *wqe, GFP_KERNEL); if (!skb) { ret = -ENOMEM; goto out; } ret = alloc_ird(rhp, qhp->attr.max_ird); if (ret) { qhp->attr.max_ird = 0; kfree_skb(skb); goto out; } set_wr_txq(skb, CPL_PRIORITY_DATA, qhp->ep->txq_idx); - wqe = __skb_put(skb, sizeof(*wqe)); - memset(wqe, 0, sizeof *wqe); + wqe = __skb_put_zero(skb, sizeof(*wqe)); wqe->op_compl = cpu_to_be32(FW_WR_OP_V(FW_RI_INIT_WR) | FW_WR_COMPL_F); wqe->flowid_len16 = cpu_to_be32(FW_WR_FLOWID_V(qhp->ep->hwtid) | FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*wqe), 16))); wqe->cookie = (uintptr_t)qhp->ep->com.wr_waitp; wqe->u.init.type = FW_RI_TYPE_INIT; wqe->u.init.mpareqbit_p2ptype = FW_RI_WR_MPAREQBIT_V(qhp->attr.mpa_attr.initiator) | FW_RI_WR_P2PTYPE_V(qhp->attr.mpa_attr.p2p_type); wqe->u.init.mpa_attrs = FW_RI_MPA_IETF_ENABLE; if (qhp->attr.mpa_attr.recv_marker_enabled) wqe->u.init.mpa_attrs |= FW_RI_MPA_RX_MARKER_ENABLE; if (qhp->attr.mpa_attr.xmit_marker_enabled) wqe->u.init.mpa_attrs |= FW_RI_MPA_TX_MARKER_ENABLE; if (qhp->attr.mpa_attr.crc_enabled) wqe->u.init.mpa_attrs |= FW_RI_MPA_CRC_ENABLE; wqe->u.init.qp_caps = FW_RI_QP_RDMA_READ_ENABLE | FW_RI_QP_RDMA_WRITE_ENABLE | FW_RI_QP_BIND_ENABLE; if (!qhp->ibqp.uobject) wqe->u.init.qp_caps |= FW_RI_QP_FAST_REGISTER_ENABLE | FW_RI_QP_STAG0_ENABLE; wqe->u.init.nrqe = cpu_to_be16(t4_rqes_posted(&qhp->wq)); wqe->u.init.pdid = cpu_to_be32(qhp->attr.pd); wqe->u.init.qpid = cpu_to_be32(qhp->wq.sq.qid); wqe->u.init.sq_eqid = cpu_to_be32(qhp->wq.sq.qid); wqe->u.init.rq_eqid = cpu_to_be32(qhp->wq.rq.qid); wqe->u.init.scqid = cpu_to_be32(qhp->attr.scq); wqe->u.init.rcqid = cpu_to_be32(qhp->attr.rcq); wqe->u.init.ord_max = cpu_to_be32(qhp->attr.max_ord); wqe->u.init.ird_max = cpu_to_be32(qhp->attr.max_ird); wqe->u.init.iss = cpu_to_be32(qhp->ep->snd_seq); wqe->u.init.irs = cpu_to_be32(qhp->ep->rcv_seq); wqe->u.init.hwrqsize = cpu_to_be32(qhp->wq.rq.rqt_size); wqe->u.init.hwrqaddr = cpu_to_be32(qhp->wq.rq.rqt_hwaddr - rhp->rdev.lldi.vr->rq.start); if (qhp->attr.mpa_attr.initiator) build_rtr_msg(qhp->attr.mpa_attr.p2p_type, &wqe->u.init); ret = c4iw_ref_send_wait(&rhp->rdev, skb, qhp->ep->com.wr_waitp, qhp->ep->hwtid, qhp->wq.sq.qid, __func__); if (!ret) goto out; free_ird(rhp, qhp->attr.max_ird); out: pr_debug("ret %d\n", ret); return ret; }<sep>@@ expression skb,req; type T; @@ req = (T) - __skb_put + __skb_put_zero (skb, sizeof(*req)); ... - memset(req, 0, sizeof *req); <|end_of_text|>
1,254
--- initial +++ final @@ -1,29 +1,28 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, int paylen, struct rxe_pkt_info *pkt) { unsigned int hdr_len; struct sk_buff *skb; struct net_device *ndev; const int port_num = 1; ndev = rxe_netdev_from_av(rxe, port_num, av); if (av->network_type == RDMA_NETWORK_IPV4) hdr_len = ETH_HLEN + sizeof(struct udphdr) + sizeof(struct iphdr); else hdr_len = ETH_HLEN + sizeof(struct udphdr) + sizeof(struct ipv6hdr); skb = alloc_skb(paylen + hdr_len + LL_RESERVED_SPACE(ndev), GFP_ATOMIC); if (unlikely(!skb)) { dev_put(ndev); return NULL; } skb_reserve(skb, hdr_len + LL_RESERVED_SPACE(rxe->ndev)); skb->dev = ndev; if (av->network_type == RDMA_NETWORK_IPV4) skb->protocol = htons(ETH_P_IP); else skb->protocol = htons(ETH_P_IPV6); pkt->rxe = rxe; pkt->port_num = port_num; - pkt->hdr = skb_put(skb, paylen); + pkt->hdr = skb_put_zero(skb, paylen); pkt->mask |= RXE_GRH_MASK; - memset(pkt->hdr, 0, paylen); dev_put(ndev); return skb; }<sep>@@ expression skb,len,req; type T; @@ req = (T) - skb_put + skb_put_zero (skb, len); ... - memset(req, 0, len); <|end_of_text|>
1,255
--- initial +++ final @@ -1,13 +1,13 @@ static int mt2701_afe_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); struct mt2701_afe_private *afe_priv = afe->platform_priv; int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); if (i2s_num < 0) return i2s_num; /* mclk */ if (dir == SND_SOC_CLOCK_IN) { dev_warn(dai->dev, "%s() warning: mt2701 doesn't support mclk input\n", __func__); return -EINVAL; } afe_priv->i2s_path[i2s_num].mclk_rate = freq; return 0; }<sep>@@ identifier f,dai,afe; expression substream; @@ f(...,struct snd_soc_dai *dai,...) { ... - struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); ... } <|end_of_text|>
1,258
--- initial +++ final @@ -1,13 +1,13 @@ int mtk_afe_dai_resume(struct snd_soc_dai *dai) { - struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); struct device *dev = afe->dev; struct regmap *regmap = afe->regmap; int i = 0; if (pm_runtime_status_suspended(dev) || !afe->suspended) return 0; afe->runtime_resume(dev); if (!afe->reg_back_up) dev_dbg(dev, "%s no reg_backup\n", __func__); for (i = 0; i < afe->reg_back_up_list_num; i++) mtk_regmap_write(regmap, afe->reg_back_up_list[i], afe->reg_back_up[i]); afe->suspended = false; return 0; }<sep>@@ identifier f,dai,afe; expression substream; @@ f(...,struct snd_soc_dai *dai,...) { ... - struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); ... } <|end_of_text|>
1,278
--- initial +++ final @@ -1,13 +1,13 @@ int mtk_afe_dai_suspend(struct snd_soc_dai *dai) { - struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); struct device *dev = afe->dev; struct regmap *regmap = afe->regmap; int i; if (pm_runtime_status_suspended(dev) || afe->suspended) return 0; if (!afe->reg_back_up) afe->reg_back_up = devm_kcalloc(dev, afe->reg_back_up_list_num, sizeof(unsigned int), GFP_KERNEL); for (i = 0; i < afe->reg_back_up_list_num; i++) regmap_read(regmap, afe->reg_back_up_list[i], &afe->reg_back_up[i]); afe->suspended = true; afe->runtime_suspend(dev); return 0; }<sep>@@ identifier f,dai,afe; expression substream; @@ f(...,struct snd_soc_dai *dai,...) { ... - struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); ... } <|end_of_text|>
1,279
--- initial +++ final @@ -1,37 +1,35 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, struct tc_cls_matchall_offload *cls, bool ingress) { struct dsa_port *dp = dsa_slave_to_port(dev); struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_mall_tc_entry *mall_tc_entry; __be16 protocol = cls->common.protocol; struct dsa_switch *ds = dp->ds; struct net_device *to_dev; const struct tc_action *a; struct dsa_port *to_dp; int err = -EOPNOTSUPP; - LIST_HEAD(actions); if (!ds->ops->port_mirror_add) return err; if (!tcf_exts_has_one_action(cls->exts)) return err; - tcf_exts_to_list(cls->exts, &actions); - a = list_first_entry(&actions, struct tc_action, list); + a = tcf_exts_first_action(cls->exts); if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) { struct dsa_mall_mirror_tc_entry *mirror; to_dev = tcf_mirred_dev(a); if (!to_dev) return -EINVAL; if (!dsa_slave_dev_check(to_dev)) return -EOPNOTSUPP; mall_tc_entry = kzalloc(sizeof(*mall_tc_entry), GFP_KERNEL); if (!mall_tc_entry) return -ENOMEM; mall_tc_entry->cookie = cls->cookie; mall_tc_entry->type = DSA_PORT_MALL_MIRROR; mirror = &mall_tc_entry->mirror; to_dp = dsa_slave_to_port(to_dev); mirror->to_local_port = to_dp->index; mirror->ingress = ingress; err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress); if (err) { kfree(mall_tc_entry); return err; } list_add_tail(&mall_tc_entry->list, &p->mall_tc_list); } return 0; }<sep>@@ identifier actions; expression a,exts; @@ - LIST_HEAD(actions); ... - tcf_exts_to_list(exts, &actions); - a = list_first_entry(&actions, struct tc_action, list); + a = tcf_exts_first_action(exts); <|end_of_text|>
1,294
--- initial +++ final @@ -1,33 +1,31 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port, struct tc_cls_matchall_offload *f, bool ingress) { struct mlxsw_sp_port_mall_tc_entry *mall_tc_entry; __be16 protocol = f->common.protocol; const struct tc_action *a; - LIST_HEAD(actions); int err; if (!tcf_exts_has_one_action(f->exts)) { netdev_err(mlxsw_sp_port->dev, "only singular actions are supported\n"); return -EOPNOTSUPP; } mall_tc_entry = kzalloc(sizeof(*mall_tc_entry), GFP_KERNEL); if (!mall_tc_entry) return -ENOMEM; mall_tc_entry->cookie = f->cookie; - tcf_exts_to_list(f->exts, &actions); - a = list_first_entry(&actions, struct tc_action, list); + a = tcf_exts_first_action(f->exts); if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) { struct mlxsw_sp_port_mall_mirror_tc_entry *mirror; mall_tc_entry->type = MLXSW_SP_PORT_MALL_MIRROR; mirror = &mall_tc_entry->mirror; err = mlxsw_sp_port_add_cls_matchall_mirror(mlxsw_sp_port, mirror, a, ingress); } else if (is_tcf_sample(a) && protocol == htons(ETH_P_ALL)) { mall_tc_entry->type = MLXSW_SP_PORT_MALL_SAMPLE; err = mlxsw_sp_port_add_cls_matchall_sample(mlxsw_sp_port, f, a, ingress); } else { err = -EOPNOTSUPP; } if (err) goto err_add_action; list_add_tail(&mall_tc_entry->list, &mlxsw_sp_port->mall_tc_list); return 0; err_add_action: kfree(mall_tc_entry); return err; }<sep>@@ identifier actions; expression a,exts; @@ - LIST_HEAD(actions); ... - tcf_exts_to_list(exts, &actions); - a = list_first_entry(&actions, struct tc_action, list); + a = tcf_exts_first_action(exts); <|end_of_text|>
1,296
--- initial +++ final @@ -1,4 +1,4 @@ static void ulite_console_putchar(struct uart_port *port, int ch) { ulite_console_wait_tx(port); - iowrite32be(ch, port->membase + ULITE_TX); + uart_out32(ch, ULITE_TX, port); }<sep>@@ expression e1,e2,port; @@ - iowrite32be(e1, port->membase + e2); + uart_out32(e1, e2, port); <|end_of_text|>
7,078
--- initial +++ final @@ -1,18 +1,18 @@ static void ulite_console_write(struct console *co, const char *s, unsigned int count) { struct uart_port *port = &ulite_ports[co->index]; unsigned long flags; unsigned int ier; int locked = 1; if (oops_in_progress) { locked = spin_trylock_irqsave(&port->lock, flags); } else spin_lock_irqsave(&port->lock, flags); /* save and disable interrupt */ - ier = ioread32be(port->membase + ULITE_STATUS) & ULITE_STATUS_IE; - iowrite32be(0, port->membase + ULITE_CONTROL); + ier = uart_in32(ULITE_STATUS, port) & ULITE_STATUS_IE; + uart_out32(0, ULITE_CONTROL, port); uart_console_write(port, s, count, ulite_console_putchar); ulite_console_wait_tx(port); /* restore interrupt state */ - if (ier) iowrite32be(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL); + if (ier) uart_out32(ULITE_CONTROL_IE, ULITE_CONTROL, port); if (locked) spin_unlock_irqrestore(&port->lock, flags); }<sep>@@ expression port,e; @@ - ioread32be(port->membase + e) + uart_in32(e, port) @@ expression e1,e2,port; @@ - iowrite32be(e1, port->membase + e2); + uart_out32(e1, e2, port); <|end_of_text|>
7,080
--- initial +++ final @@ -1,6 +1,6 @@ static void ulite_put_poll_char(struct uart_port *port, unsigned char ch) { - while (ioread32be(port->membase + ULITE_STATUS) & ULITE_STATUS_TXFULL) + while (uart_in32(ULITE_STATUS, port) & ULITE_STATUS_TXFULL) cpu_relax(); /* write char to device */ - iowrite32be(ch, port->membase + ULITE_TX); + uart_out32(ch, ULITE_TX, port); }<sep>@@ expression port,e; @@ - ioread32be(port->membase + e) + uart_in32(e, port) @@ expression e1,e2,port; @@ - iowrite32be(e1, port->membase + e2); + uart_out32(e1, e2, port); <|end_of_text|>
7,083
--- initial +++ final @@ -1,5 +1,5 @@ static void ulite_shutdown(struct uart_port *port) { - iowrite32be(0, port->membase + ULITE_CONTROL); - ioread32be(port->membase + ULITE_CONTROL); /* dummy */ + uart_out32(0, ULITE_CONTROL, port); + uart_in32(ULITE_CONTROL, port); /* dummy */ free_irq(port->irq, port); }<sep>@@ expression port,e; @@ - ioread32be(port->membase + e) + uart_in32(e, port) @@ expression e1,e2,port; @@ - iowrite32be(e1, port->membase + e2); + uart_out32(e1, e2, port); <|end_of_text|>
7,085
--- initial +++ final @@ -1,8 +1,8 @@ static int ulite_startup(struct uart_port *port) { int ret; ret = request_irq(port->irq, ulite_isr, IRQF_SHARED, "uartlite", port); if (ret) return ret; - iowrite32be(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX, port->membase + ULITE_CONTROL); - iowrite32be(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL); + uart_out32(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX, ULITE_CONTROL, port); + uart_out32(ULITE_CONTROL_IE, ULITE_CONTROL, port); return 0; }<sep>@@ expression e1,e2,port; @@ - iowrite32be(e1, port->membase + e2); + uart_out32(e1, e2, port); <|end_of_text|>
7,087