nfc: NULL vs zero in nci_activate_target()
Subsystems (40)
PATCH 1/1 nfc: NULL vs zero in nci_activate_target()
This is a pointer so it should be NULL instead of zero. Sparse complains about this stuff:net/nfc/nci/core.c:447:37: warning: Using plain integer as NULL pointer
net/nfc/nci/core.c +1 -1
@@ -444,7 +444,7 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx, {struct nci_dev *ndev =nfc_get_drvdata (nfc_dev);struct nci_rf_discover_select_param param; -struct nfc_target *target =0 ; +struct nfc_target *target =NULL ;int i;int rc =0 ;
drivers: Use NULL not zero for pointer
Here are some assignments that should use NULL
not 0;
Done via script:
$ grep -rPl --include=*.[ch] "\bstruct\s+\w+\s*\*\s*\w+\s*\=\s*0\s*;" drivers | \ xargs sed -r -i -e 's/\b(struct\s+\w+\s*\*\s*\w+)\s*\=\s*0\s*;/\1 = NULL;/g'
--- drivers/gpu/drm/gma500/framebuffer.c | 4 ++-- drivers/input/input-mt.c | 2 +- drivers/iommu/amd_iommu_init.c | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 2 +- drivers/staging/gma500/framebuffer.c | 4 ++-- drivers/staging/media/cxd2099/cxd2099.c | 2 +- drivers/tty/serial/68328serial.c | 2 +- drivers/usb/host/ohci-omap.c | 2 +- drivers/usb/host/ohci-pnx4008.c | 2 +- drivers/video/pxa168fb.c | 4 ++-- drivers/video/smscufx.c | 2 +- drivers/video/udlfb.c | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +2 -2
@@ -113,7 +113,7 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)void psbfb_suspend (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
@@ -129,7 +129,7 @@ void psbfb_suspend(struct drm_device *dev)void psbfb_resume (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
drivers/input/input-mt.c +1 -1
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(input_mt_report_finger_count);*/ void input_mt_report_pointer_emulation (struct input_dev *dev,bool use_count) { -struct input_mt_slot *oldest =0 ; +struct input_mt_slot *oldest =NULL ;int oldid = dev->trkid;int count =0 ;int i;
drivers/iommu/amd_iommu_init.c +1 -1
@@ -1210,7 +1210,7 @@ static int __init init_exclusion_range(struct ivmd_header *m)/* called for unity map ACPI definition */ static int __init init_unity_map_range (struct ivmd_header *m) { -struct unity_map_entry *e =0 ; +struct unity_map_entry *e =NULL ;char *s; e =kzalloc (sizeof (*e),GFP_KERNEL );
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -15898,7 +15898,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) {LIST_HEAD (completions);struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING ]; -struct lpfc_iocbq *piocbq =0 ; +struct lpfc_iocbq *piocbq =NULL ;unsigned long iflags =0 ;char *fail_msg =NULL ;struct lpfc_sglq *sglq;
drivers/staging/gma500/framebuffer.c +2 -2
@@ -111,7 +111,7 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)void psbfb_suspend (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
@@ -127,7 +127,7 @@ void psbfb_suspend(struct drm_device *dev)void psbfb_resume (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
drivers/staging/media/cxd2099/cxd2099.c +1 -1
@@ -683,7 +683,7 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg,void *priv, struct i2c_adapter *i2c) { - struct cxd *ci = 0; + struct cxd *ci = NULL;u8 val;if (i2c_read_reg (i2c, cfg->adr,0 , &val) <0 ) {
drivers/tty/serial/68328serial.c +1 -1
@@ -74,7 +74,7 @@ static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS;m68328_uart *uart_addr = (m68328_uart *)USTCNT_ADDR ;struct tty_struct m68k_ttys; -struct m68k_serial *m68k_consinfo =0 ; +struct m68k_serial *m68k_consinfo =NULL ;#define M68K_CLOCK (16667000)/* FIXME: 16MHz is likely wrong */
drivers/usb/host/ohci-omap.c +1 -1
@@ -301,7 +301,7 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver, struct platform_device *pdev) {int retval, irq; -struct usb_hcd *hcd =0 ; +struct usb_hcd *hcd =NULL ;struct ohci_hcd *ohci;if (pdev->num_resources !=2 ) {
drivers/usb/host/ohci-pnx4008.c +1 -1
@@ -294,7 +294,7 @@ static void pnx4008_unset_usb_bits(void)static int __devinit usb_hcd_pnx4008_probe (struct platform_device *pdev) { -struct usb_hcd *hcd =0 ; +struct usb_hcd *hcd =NULL ;struct ohci_hcd *ohci;const struct hc_driver *driver = &ohci_pnx4008_hc_driver;struct i2c_adapter *i2c_adap;
drivers/video/pxa168fb.c +2 -2
@@ -602,8 +602,8 @@ static int __devinit pxa168fb_init_mode(struct fb_info *info,static int __devinit pxa168fb_probe (struct platform_device *pdev) {struct pxa168fb_mach_info *mi; -struct fb_info *info =0 ; -struct pxa168fb_info *fbi =0 ; +struct fb_info *info =NULL ; +struct pxa168fb_info *fbi =NULL ;struct resource *res;struct clk *clk;int irq, ret;
drivers/video/smscufx.c +1 -1
@@ -1619,7 +1619,7 @@ static int ufx_usb_probe(struct usb_interface *interface, {struct usb_device *usbdev;struct ufx_data *dev; -struct fb_info *info =0 ; +struct fb_info *info =NULL ;int retval = -ENOMEM ;u32 id_rev, fpga_rev;
drivers/video/udlfb.c +2 -2
@@ -1574,8 +1574,8 @@ static int dlfb_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) {struct usb_device *usbdev; -struct dlfb_data *dev =0 ; -struct fb_info *info =0 ; +struct dlfb_data *dev =NULL ; +struct fb_info *info =NULL ;int retval = -ENOMEM ;int i;
PATCH v2 1/1 drivers: Use NULL not zero pointer assignments
Using NULL pointer assignments is more kernel-style standard.
Uncompiled, untested.
Done via cocinelle script:
@@
type T;
T *pointer;
@@
-pointer = 0
+pointer = NULL
--- drivers/atm/ambassador.c | 2 +- drivers/atm/nicstar.c | 8 +++--- drivers/char/msm_smd_pkt.c | 4 +- drivers/crypto/ixp4xx_crypto.c | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 4 +- drivers/gpu/drm/nouveau/nv50_instmem.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- drivers/i2c/busses/i2c-eg20t.c | 2 +- drivers/i2c/busses/i2c-s6000.c | 2 +- drivers/input/input-mt.c | 2 +- drivers/iommu/amd_iommu_init.c | 2 +- drivers/isdn/hardware/mISDN/hfc_multi_8xx.h | 2 +- drivers/macintosh/therm_pm72.c | 2 +- drivers/media/dvb/ddbridge/ddbridge-core.c | 6 ++-- drivers/media/dvb/ngene/ngene-core.c | 2 +- drivers/media/video/hdpvr/hdpvr-core.c | 2 +- drivers/media/video/s5p-g2d/g2d.c | 2 +- drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c | 14 ++++++------ drivers/media/video/s5p-mfc/s5p_mfc_opr.c | 26 +++++++++++----------- drivers/mfd/menelaus.c | 2 +- drivers/mtd/maps/autcpu12-nvram.c | 2 +- drivers/mtd/maps/cdb89712.c | 6 ++-- drivers/mtd/maps/impa7.c | 2 +- drivers/mtd/maps/tqm8xxl.c | 2 +- drivers/mtd/maps/tsunami_flash.c | 4 +- drivers/net/cris/eth_v10.c | 6 ++-- drivers/net/ethernet/neterion/vxge/vxge-config.c | 2 +- drivers/net/ethernet/packetengines/yellowfin.c | 4 +- drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +- drivers/net/ethernet/sgi/meth.c | 2 +- drivers/net/fddi/skfp/hwmtm.c | 6 ++-- drivers/parport/parport_gsc.c | 2 +- drivers/scsi/NCR53c406a.c | 2 +- drivers/scsi/atari_scsi.c | 6 ++-- drivers/scsi/be2iscsi/be_cmds.c | 8 +++--- drivers/scsi/be2iscsi/be_main.c | 4 +- drivers/scsi/lpfc/lpfc_sli.c | 2 +- drivers/scsi/mvumi.c | 6 ++-- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/pmcraid.c | 2 +- drivers/scsi/qla2xxx/qla_nx.c | 6 ++-- drivers/spi/spi-au1550.c | 4 +- drivers/staging/comedi/drivers/jr3_pci.c | 2 +- drivers/staging/comedi/drivers/pcmmio.c | 4 +- drivers/staging/comedi/drivers/pcmuio.c | 4 +- drivers/staging/comedi/drivers/s626.c | 2 +- drivers/staging/comedi/drivers/serial2002.c | 6 ++-- drivers/staging/cxt1e1/hwprobe.c | 2 +- drivers/staging/cxt1e1/linux.c | 4 +- drivers/staging/cxt1e1/musycc.c | 8 +++--- drivers/staging/cxt1e1/pmcc4_drv.c | 10 ++++---- drivers/staging/cxt1e1/sbecrc.c | 2 +- drivers/staging/cxt1e1/sbeid.c | 2 +- drivers/staging/cxt1e1/sbeproc.c | 2 +- drivers/staging/gma500/framebuffer.c | 4 +- drivers/staging/iio/Documentation/iio_utils.h | 4 +- drivers/staging/line6/midi.c | 2 +- drivers/staging/media/cxd2099/cxd2099.c | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 4 +- drivers/staging/sep/sep_driver.c | 4 +- drivers/tty/serial/68328serial.c | 4 +- drivers/tty/serial/msm_smd_tty.c | 2 +- drivers/usb/gadget/f_mass_storage.c | 8 +++--- drivers/usb/gadget/fsl_udc_core.c | 2 +- drivers/usb/gadget/s3c-hsudc.c | 8 +++--- drivers/usb/host/ohci-omap.c | 2 +- drivers/usb/host/ohci-pnx4008.c | 2 +- drivers/video/atafb.c | 2 +- drivers/video/msm/mddi.c | 4 +- drivers/video/msm/mddi_client_toshiba.c | 2 +- drivers/video/msm/mdp.c | 2 +- drivers/video/pxa168fb.c | 4 +- drivers/video/smscufx.c | 4 +- drivers/video/udlfb.c | 14 ++++++------ 74 files changed, 150 insertions(+), 150 deletions(-)
drivers/atm/ambassador.c +1 -1
@@ -1922,7 +1922,7 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {const struct firmware *fw;unsigned long start_address;const struct ihex_binrec *rec; -const char *errmsg =0 ; +const char *errmsg =NULL ;int res; res =request_ihex_firmware (&fw,"atmsar11.fw" , &dev->pci_dev->dev);
drivers/atm/nicstar.c +4 -4
@@ -640,9 +640,9 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev) card->hbnr.init =NUM_HB ; card->hbnr.max =MAX_HB ; - card->sm_handle =0x00000000 ; + card->sm_handle =NULL ; card->sm_addr =0x00000000 ; - card->lg_handle =0x00000000 ; + card->lg_handle =NULL ; card->lg_addr =0x00000000 ; card->efbie =1 ;/* To prevent push_rxbufs from enabling the interrupt */
@@ -982,7 +982,7 @@ static void push_rxbufs(ns_dev * card, struct sk_buff *skb) addr2 = card->sm_addr; handle2 = card->sm_handle; card->sm_addr =0x00000000 ; - card->sm_handle =0x00000000 ; + card->sm_handle =NULL ; }else {/* (!sm_addr) */ card->sm_addr = addr1;
@@ -996,7 +996,7 @@ static void push_rxbufs(ns_dev * card, struct sk_buff *skb) addr2 = card->lg_addr; handle2 = card->lg_handle; card->lg_addr =0x00000000 ; - card->lg_handle =0x00000000 ; + card->lg_handle =NULL ; }else {/* (!lg_addr) */ card->lg_addr = addr1;
drivers/char/msm_smd_pkt.c +2 -2
@@ -319,7 +319,7 @@ static int smd_pkt_open(struct inode *inode, struct file *file)if (r <0 ) {pr_err ("wait returned %d\n" , r);smd_close (smd_pkt_devp->ch); - smd_pkt_devp->ch =0 ; + smd_pkt_devp->ch =NULL ; }else { smd_pkt_devp->open_count++; r =0 ;
@@ -341,7 +341,7 @@ static int smd_pkt_release(struct inode *inode, struct file *file)mutex_lock (&smd_pkt_devp->ch_lock);if (--smd_pkt_devp->open_count =0 ) { r =smd_close (smd_pkt_devp->ch); - smd_pkt_devp->ch =0 ; + smd_pkt_devp->ch =NULL ; }mutex_unlock (&smd_pkt_devp->ch_lock);
drivers/crypto/ixp4xx_crypto.c +1 -1
@@ -642,7 +642,7 @@ static int register_chain_var(struct crypto_tfm *tfm, u8 xpad, u32 target, crypt->init_len = init_len; crypt->ctl_flags |=CTL_FLAG_GEN_ICV ; - buf->next =0 ; + buf->next =NULL ; buf->buf_len =HMAC_PAD_BLOCKLEN ; buf->pkt_len =0 ; buf->phys_addr = pad_phys;
drivers/gpu/drm/gma500/framebuffer.c +2 -2
@@ -113,7 +113,7 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)void psbfb_suspend (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
@@ -129,7 +129,7 @@ void psbfb_suspend(struct drm_device *dev)void psbfb_resume (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
drivers/gpu/drm/nouveau/nv50_instmem.c +1 -1
@@ -253,7 +253,7 @@ nv50_instmem_takedown(struct drm_device *dev)nouveau_gpuobj_ref (NULL , &priv->bar1_dmaobj);nouveau_vm_ref (NULL , &dev_priv->bar1_vm, chan->vm_pd); - dev_priv->channels.ptr[127 ] =0 ; + dev_priv->channels.ptr[127 ] =NULL ;nv50_channel_del (&dev_priv->channels.ptr[0 ]);nouveau_gpuobj_ref (NULL , &dev_priv->bar3_vm->pgt[0 ].obj[0 ]);
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
@@ -378,7 +378,7 @@ int vmw_framebuffer_create_handle(struct drm_framebuffer *fb, unsigned int *handle) {if (handle) - handle =0 ; + handle =NULL ;return 0 ; }
drivers/i2c/busses/i2c-eg20t.c +1 -1
@@ -965,7 +965,7 @@ static void __devexit pch_i2c_remove(struct pci_dev *pdev)pci_iounmap (pdev, adap_info->pch_data[0 ].pch_base_address);for (i =0 ; i < adap_info->ch_num; i++) - adap_info->pch_data[i].pch_base_address =0 ; + adap_info->pch_data[i].pch_base_address =NULL ;pci_set_drvdata (pdev,NULL );
drivers/i2c/busses/i2c-s6000.c +1 -1
@@ -288,7 +288,7 @@ static int __devinit s6i2c_probe(struct platform_device *dev) goto err_reg; } - clock =0 ; + clock =NULL ; bus_num =-1 ;if (dev->dev.platform_data) {struct s6_i2c_platform_data *pdata = dev->dev.platform_data;
drivers/input/input-mt.c +1 -1
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(input_mt_report_finger_count);*/ void input_mt_report_pointer_emulation (struct input_dev *dev,bool use_count) { -struct input_mt_slot *oldest =0 ; +struct input_mt_slot *oldest =NULL ;int oldid = dev->trkid;int count =0 ;int i;
drivers/iommu/amd_iommu_init.c +1 -1
@@ -1210,7 +1210,7 @@ static int __init init_exclusion_range(struct ivmd_header *m)/* called for unity map ACPI definition */ static int __init init_unity_map_range (struct ivmd_header *m) { -struct unity_map_entry *e =0 ; +struct unity_map_entry *e =NULL ;char *s; e =kzalloc (sizeof (*e),GFP_KERNEL );
drivers/isdn/hardware/mISDN/hfc_multi_8xx.h +1 -1
@@ -108,7 +108,7 @@ setup_embedded(struct hfc_multi *hc, struct hm_map *m) hc->opticalsupport = m->opticalsupport; hc->pci_iobase =0 ; - hc->pci_membase =0 ; + hc->pci_membase =NULL ; hc->xhfc_membase =NULL ; hc->xhfc_memaddr =NULL ; hc->xhfc_memdata =NULL ;
drivers/macintosh/therm_pm72.c +1 -1
@@ -1876,7 +1876,7 @@ static int main_control_loop(void *x) out:DBG ("main_control_loop ended\n" ); - ctrl_task =0 ; + ctrl_task =NULL ;complete_and_exit (&ctrl_complete,0 ); }
drivers/media/dvb/ddbridge/ddbridge-core.c +3 -3
@@ -267,7 +267,7 @@ static void io_free(struct pci_dev *pdev, u8 **vbuf,for (i =0 ; i < num; i++) {if (vbuf[i]) {pci_free_consistent (pdev, size, vbuf[i], pbuf[i]); - vbuf[i] =0 ; + vbuf[i] =NULL ; } } }
@@ -849,7 +849,7 @@ static int dvb_input_attach(struct ddb_input *input)return ret; input->attached =4 ; - input->fe =0 ; + input->fe =NULL ;switch (port->type) {case DDB_TUNER_DVBS_ST :if (demod_attach_stv0900 (input,0 ) <0 )
@@ -1129,7 +1129,7 @@ static void ddb_ports_detach(struct ddb *dev)ddb_output_stop (port->output);dvb_ca_en50221_release (port->en);kfree (port->en); - port->en =0 ; + port->en =NULL ;dvb_unregister_adapter (&port->output->adap); }break ;
drivers/media/dvb/ngene/ngene-core.c +1 -1
@@ -1604,7 +1604,7 @@ static void cxd_detach(struct ngene *dev)dvb_ca_en50221_release (ci->en);kfree (ci->en); - ci->en =0 ; + ci->en =NULL ; }/***********************************/
drivers/media/video/hdpvr/hdpvr-core.c +1 -1
@@ -295,7 +295,7 @@ static int hdpvr_probe(struct usb_interface *interface, goto error; } - dev->workqueue =0 ; + dev->workqueue =NULL ;/* register v4l2_device early so it can be used for printks */ if (v4l2_device_register (&interface->dev, &dev->v4l2_dev)) {
drivers/media/video/s5p-g2d/g2d.c +1 -1
@@ -592,7 +592,7 @@ static irqreturn_t g2d_isr(int irq, void *prv)v4l2_m2m_buf_done (dst,VB2_BUF_STATE_DONE );v4l2_m2m_job_finish (dev->m2m_dev, ctx->m2m_ctx); - dev->curr =0 ; + dev->curr =NULL ;wake_up (&dev->irq_queue);return IRQ_HANDLED ; }
drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c +7 -7
@@ -52,7 +52,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) s5p_mfc_bitproc_buf = vb2_dma_contig_memops.alloc ( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX ], dev->fw_size);if (IS_ERR (s5p_mfc_bitproc_buf)) { - s5p_mfc_bitproc_buf =0 ; + s5p_mfc_bitproc_buf =NULL ;mfc_err ("Allocating bitprocessor buffer failed\n" );release_firmware (fw_blob);return -ENOMEM ;
@@ -63,7 +63,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)mfc_err ("The base memory for bank 1 is not aligned to 128KB\n" ); vb2_dma_contig_memops.put (s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys =0 ; - s5p_mfc_bitproc_buf =0 ; + s5p_mfc_bitproc_buf =NULL ;release_firmware (fw_blob);return -EIO ; }
@@ -72,7 +72,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)mfc_err ("Bitprocessor memory remap failed\n" ); vb2_dma_contig_memops.put (s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys =0 ; - s5p_mfc_bitproc_buf =0 ; + s5p_mfc_bitproc_buf =NULL ;release_firmware (fw_blob);return -EIO ; }
@@ -82,7 +82,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)if (IS_ERR (b_base)) { vb2_dma_contig_memops.put (s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys =0 ; - s5p_mfc_bitproc_buf =0 ; + s5p_mfc_bitproc_buf =NULL ;mfc_err ("Allocating bank2 base failed\n" );release_firmware (fw_blob);return -ENOMEM ;
@@ -94,7 +94,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)mfc_err ("The base memory for bank 2 is not aligned to 128KB\n" ); vb2_dma_contig_memops.put (s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys =0 ; - s5p_mfc_bitproc_buf =0 ; + s5p_mfc_bitproc_buf =NULL ;release_firmware (fw_blob);return -EIO ; }
@@ -146,9 +146,9 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev)if (!s5p_mfc_bitproc_buf)return -EINVAL ; vb2_dma_contig_memops.put (s5p_mfc_bitproc_buf); - s5p_mfc_bitproc_virt =0 ; + s5p_mfc_bitproc_virt =NULL ; s5p_mfc_bitproc_phys =0 ; - s5p_mfc_bitproc_buf =0 ; + s5p_mfc_bitproc_buf =NULL ;return 0 ; }
drivers/media/video/s5p-mfc/s5p_mfc_opr.c +13 -13
@@ -43,7 +43,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx) ctx->desc_buf = vb2_dma_contig_memops.alloc ( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX ],DESC_BUF_SIZE );if (IS_ERR_VALUE ((int )ctx->desc_buf)) { - ctx->desc_buf =0 ; + ctx->desc_buf =NULL ;mfc_err ("Allocating DESC buffer failed\n" );return -ENOMEM ; }
@@ -54,7 +54,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx)if (desc_virt =NULL ) { vb2_dma_contig_memops.put (ctx->desc_buf); ctx->desc_phys =0 ; - ctx->desc_buf =0 ; + ctx->desc_buf =NULL ;mfc_err ("Remapping DESC buffer failed\n" );return -ENOMEM ; }
@@ -69,7 +69,7 @@ void s5p_mfc_release_dec_desc_buffer(struct s5p_mfc_ctx *ctx)if (ctx->desc_phys) { vb2_dma_contig_memops.put (ctx->desc_buf); ctx->desc_phys =0 ; - ctx->desc_buf =0 ; + ctx->desc_buf =NULL ; } }
@@ -186,7 +186,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx) ctx->bank1_buf = vb2_dma_contig_memops.alloc ( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX ], ctx->bank1_size);if (IS_ERR (ctx->bank1_buf)) { - ctx->bank1_buf =0 ; + ctx->bank1_buf =NULL ;printk (KERN_ERR "Buf alloc for decoding failed (port A)\n" );return -ENOMEM ;
@@ -200,7 +200,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx) ctx->bank2_buf = vb2_dma_contig_memops.alloc ( dev->alloc_ctx[MFC_BANK2_ALLOC_CTX ], ctx->bank2_size);if (IS_ERR (ctx->bank2_buf)) { - ctx->bank2_buf =0 ; + ctx->bank2_buf =NULL ;mfc_err ("Buf alloc for decoding failed (port B)\n" );return -ENOMEM ; }
@@ -216,13 +216,13 @@ void s5p_mfc_release_codec_buffers(struct s5p_mfc_ctx *ctx) {if (ctx->bank1_buf) { vb2_dma_contig_memops.put (ctx->bank1_buf); - ctx->bank1_buf =0 ; + ctx->bank1_buf =NULL ; ctx->bank1_phys =0 ; ctx->bank1_size =0 ; }if (ctx->bank2_buf) { vb2_dma_contig_memops.put (ctx->bank2_buf); - ctx->bank2_buf =0 ; + ctx->bank2_buf =NULL ; ctx->bank2_phys =0 ; ctx->bank2_size =0 ; }
@@ -244,7 +244,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx)if (IS_ERR (ctx->ctx_buf)) {mfc_err ("Allocating context buffer failed\n" ); ctx->ctx_phys =0 ; - ctx->ctx_buf =0 ; + ctx->ctx_buf =NULL ;return -ENOMEM ; } ctx->ctx_phys = s5p_mfc_mem_cookie(
@@ -256,7 +256,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx)mfc_err ("Remapping instance buffer failed\n" ); vb2_dma_contig_memops.put (ctx->ctx_buf); ctx->ctx_phys =0 ; - ctx->ctx_buf =0 ; + ctx->ctx_buf =NULL ;return -ENOMEM ; }/* Zero content of the allocated memory */
@@ -265,7 +265,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx)if (s5p_mfc_init_shm (ctx) <0 ) { vb2_dma_contig_memops.put (ctx->ctx_buf); ctx->ctx_phys =0 ; - ctx->ctx_buf =0 ; + ctx->ctx_buf =NULL ;return -ENOMEM ; }return 0 ;
@@ -277,12 +277,12 @@ void s5p_mfc_release_instance_buffer(struct s5p_mfc_ctx *ctx)if (ctx->ctx_buf) { vb2_dma_contig_memops.put (ctx->ctx_buf); ctx->ctx_phys =0 ; - ctx->ctx_buf =0 ; + ctx->ctx_buf =NULL ; }if (ctx->shm_alloc) { vb2_dma_contig_memops.put (ctx->shm_alloc); - ctx->shm_alloc =0 ; - ctx->shm =0 ; + ctx->shm_alloc =NULL ; + ctx->shm =NULL ; } }
drivers/mfd/menelaus.c +1 -1
@@ -442,7 +442,7 @@ void menelaus_unregister_mmc_callback(void)menelaus_remove_irq_work (MENELAUS_MMC_S2D1_IRQ ); the_menelaus->mmc_callback =NULL ; - the_menelaus->mmc_callback_data =0 ; + the_menelaus->mmc_callback_data =NULL ; }EXPORT_SYMBOL (menelaus_unregister_mmc_callback);
drivers/mtd/maps/autcpu12-nvram.c +1 -1
@@ -100,7 +100,7 @@ map: out_probe:map_destroy (sram_mtd); - sram_mtd =0 ; + sram_mtd =NULL ; out_ioremap:iounmap ((void *)autcpu12_sram_map.virt);
drivers/mtd/maps/cdb89712.c +3 -3
@@ -85,7 +85,7 @@ static int __init init_cdb89712_flash (void) out_probe:map_destroy (flash_mtd); - flash_mtd =0 ; + flash_mtd =NULL ; out_ioremap:iounmap ((void *)cdb89712_flash_map.virt); out_resource:
@@ -151,7 +151,7 @@ static int __init init_cdb89712_sram (void) out_probe:map_destroy (sram_mtd); - sram_mtd =0 ; + sram_mtd =NULL ; out_ioremap:iounmap ((void *)cdb89712_sram_map.virt); out_resource:
@@ -219,7 +219,7 @@ static int __init init_cdb89712_bootrom (void) out_probe:map_destroy (bootrom_mtd); - bootrom_mtd =0 ; + bootrom_mtd =NULL ; out_ioremap:iounmap ((void *)cdb89712_bootrom_map.virt); out_resource:
drivers/mtd/maps/impa7.c +1 -1
@@ -82,7 +82,7 @@ static int __init init_impa7(void) }simple_map_init (&impa7_map[i]); - impa7_mtd[i] =0 ; + impa7_mtd[i] =NULL ; type = rom_probe_types;for (; !impa7_mtd[i] && *type; type++) { impa7_mtd[i] =do_map_probe (*type, &impa7_map[i]);
drivers/mtd/maps/tqm8xxl.c +1 -1
@@ -237,7 +237,7 @@ static void __exit cleanup_tqm_mtd(void)if (start_scan_addr) {iounmap (start_scan_addr); - start_scan_addr =0 ; + start_scan_addr =NULL ; } }
drivers/mtd/maps/tsunami_flash.c +2 -2
@@ -79,7 +79,7 @@ static void __exit cleanup_tsunami_flash(void)mtd_device_unregister (mtd);map_destroy (mtd); } - tsunami_flash_mtd =0 ; + tsunami_flash_mtd =NULL ; }
@@ -90,7 +90,7 @@ static int __init init_tsunami_flash(void)tsunami_tig_writeb (FLASH_ENABLE_BYTE ,FLASH_ENABLE_PORT ); - tsunami_flash_mtd =0 ; + tsunami_flash_mtd =NULL ; type = rom_probe_types;for (; !tsunami_flash_mtd && *type; type++) { tsunami_flash_mtd =do_map_probe (*type, &tsunami_flash_map);
drivers/net/cris/eth_v10.c +3 -3
@@ -355,7 +355,7 @@ etrax_ethernet_init(void) TxDescList[i].descr.buf =0 ; TxDescList[i].descr.status =0 ; TxDescList[i].descr.hw_len =0 ; - TxDescList[i].skb =0 ; + TxDescList[i].skb =NULL ; } TxDescList[NBR_OF_TX_DESC -1 ].descr.ctrl = d_eol;
@@ -1072,7 +1072,7 @@ e100_tx_timeout(struct net_device *dev)/* and get rid of the packets that never got an interrupt */ while (myFirstTxDesc != myNextTxDesc) {dev_kfree_skb (myFirstTxDesc->skb); - myFirstTxDesc->skb =0 ; + myFirstTxDesc->skb =NULL ; myFirstTxDesc =phys_to_virt (myFirstTxDesc->descr.next); }
@@ -1177,7 +1177,7 @@ e100rxtx_interrupt(int irq, void *dev_id)/* dma is ready with the transmission of the data in tx_skb, so now we can release the skb memory */ dev_kfree_skb_irq (myFirstTxDesc->skb); - myFirstTxDesc->skb =0 ; + myFirstTxDesc->skb =NULL ; myFirstTxDesc =phys_to_virt (myFirstTxDesc->descr.next);/* Wake up queue. */ netif_wake_queue (dev);
drivers/net/ethernet/neterion/vxge/vxge-config.c +1 -1
@@ -4645,7 +4645,7 @@ static void __vxge_hw_vp_terminate(struct __vxge_hw_device *hldev, u32 vp_id) vpath->ringh =NULL ; vpath->fifoh =NULL ;memset (&vpath->vpath_handles,0 ,sizeof (struct list_head )); - vpath->stats_block =0 ; + vpath->stats_block =NULL ; vpath->hw_stats =NULL ; vpath->hw_stats_sav =NULL ; vpath->sw_stats =NULL ;
drivers/net/ethernet/packetengines/yellowfin.c +2 -2
@@ -777,7 +777,7 @@ static int yellowfin_init_ring(struct net_device *dev)/* Tx ring needs a pair of descriptors, the second for the status. */ for (i =0 ; i <TX_RING_SIZE ; i++) { j =2 *i; - yp->tx_skbuff[i] =0 ; + yp->tx_skbuff[i] =NULL ;/* Branch on Tx error. */ yp->tx_ring[j].dbdma_cmd =cpu_to_le32 (CMD_STOP ); yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma +
@@ -994,7 +994,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance) yp->tx_ring[entry<<1 ].addr, skb->len, PCI_DMA_TODEVICE);dev_kfree_skb_irq (skb); - yp->tx_skbuff[entry] =0 ; + yp->tx_skbuff[entry] =NULL ;/* Mark status as empty. */ yp->tx_status[entry].tx_errs =0 ; }
drivers/net/ethernet/pasemi/pasemi_mac.c +1 -1
@@ -393,7 +393,7 @@ static void pasemi_mac_setup_csrings(struct pasemi_mac *mac)if (mac->type =MAC_TYPE_XAUI ) mac->cs[1 ] =pasemi_mac_setup_csring (mac);else - mac->cs[1 ] =0 ; + mac->cs[1 ] =NULL ;for (i =0 ; i <MAX_CS ; i++)if (mac->cs[i])
drivers/net/ethernet/sgi/meth.c +1 -1
@@ -266,7 +266,7 @@ static void meth_free_rx_ring(struct meth_private *priv)for (i =0 ; i <RX_RING_ENTRIES ; i++) {dma_unmap_single (NULL , priv->rx_ring_dmas[i],METH_RX_BUFF_SIZE ,DMA_FROM_DEVICE ); - priv->rx_ring[i] =0 ; + priv->rx_ring[i] =NULL ; priv->rx_ring_dmas[i] =0 ;kfree_skb (priv->rx_skbs[i]); }
drivers/net/fddi/skfp/hwmtm.c +3 -3
@@ -46,8 +46,8 @@ static char const ID_sccs[] = "@(#)hwmtm.c 1.40 99/05/31 (C) SK" ;------------------------------------------------------------- */ #ifdef COMMON_MB_POOL -static SMbuf *mb_start =0 ; -static SMbuf *mb_free =0 ; +static SMbuf *mb_start =NULL ; +static SMbuf *mb_free =NULL ;static int mb_init = FALSE ;static int call_count =0 ;#endif
@@ -441,7 +441,7 @@ void init_fddi_driver(struct s_smc *smc, u_char *mac_addr)#else mb = mb_start ;if (!mb_init) { - mb_free =0 ; + mb_free =NULL ;for (i =0 ; i <MAX_MBUF ; i++) { mb->sm_use_count =1 ;smt_free_mbuf (smc,mb) ;
drivers/parport/parport_gsc.c +1 -1
@@ -257,7 +257,7 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,memcpy (ops, &parport_gsc_ops,sizeof (struct parport_operations )); priv->ctr =0xc ; priv->ctr_writable =0xff ; - priv->dma_buf =0 ; + priv->dma_buf =NULL ; priv->dma_handle =0 ; priv->dev = dev; p->base = base;
drivers/scsi/NCR53c406a.c +1 -1
@@ -458,7 +458,7 @@ static int __init NCR53c406a_detect(struct scsi_host_template * tpnt)#if USE_BIOS int ii, jj; - bios_base =0 ; + bios_base =NULL ;/* look for a valid signature */ for (ii =0 ; ii <ADDRESS_COUNT && !bios_base; ii++)for (jj =0 ; (jj <SIGNATURE_COUNT ) && !bios_base; jj++)
drivers/scsi/atari_scsi.c +3 -3
@@ -634,13 +634,13 @@ int __init atari_scsi_detect(struct scsi_host_template *host) return 0; } atari_dma_phys_buffer =virt_to_phys (atari_dma_buffer); - atari_dma_orig_addr =0 ; + atari_dma_orig_addr =NULL ; }#endif instance =scsi_register (host,sizeof (struct NCR5380_hostdata ));if (instance =NULL ) {atari_stram_free (atari_dma_buffer); - atari_dma_buffer =0 ; + atari_dma_buffer =NULL ;return 0 ; } atari_scsi_host = instance;
@@ -667,7 +667,7 @@ int __init atari_scsi_detect(struct scsi_host_template *host)printk (KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting" ,IRQ_TT_MFP_SCSI );scsi_unregister (atari_scsi_host);atari_stram_free (atari_dma_buffer); - atari_dma_buffer =0 ; + atari_dma_buffer =NULL ;return 0 ; } tt_mfp.active_edge |=0x80 ;/* SCSI int on L->H */
drivers/scsi/be2iscsi/be_cmds.c +4 -4
@@ -22,9 +22,9 @@int beiscsi_pci_soft_reset (struct beiscsi_hba *phba) {u32 sreset; -u8 *pci_reset_offset =0 ; -u8 *pci_online0_offset =0 ; -u8 *pci_online1_offset =0 ; +u8 *pci_reset_offset =NULL ; +u8 *pci_online0_offset =NULL ; +u8 *pci_online1_offset =NULL ;u32 pconline0 =0 ;u32 pconline1 =0 ;u32 i;
@@ -74,7 +74,7 @@ int beiscsi_pci_soft_reset(struct beiscsi_hba *phba)int be_chk_reset_complete (struct beiscsi_hba *phba) {unsigned int num_loop; -u8 *mpu_sem =0 ; +u8 *mpu_sem =NULL ;u32 status; num_loop =1000 ;
drivers/scsi/be2iscsi/be_main.c +2 -2
@@ -4132,7 +4132,7 @@ static void beiscsi_quiesce(struct beiscsi_hba *phba)struct hwi_context_memory *phwi_context;struct be_eq_obj *pbe_eq;unsigned int i, msix_vec; -u8 *real_offset =0 ; +u8 *real_offset =NULL ;u32 value =0 ; phwi_ctrlr = phba->phwi_ctrlr;
@@ -4229,7 +4229,7 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,struct hwi_context_memory *phwi_context;struct be_eq_obj *pbe_eq;int ret, num_cpus, i; -u8 *real_offset =0 ; +u8 *real_offset =NULL ;u32 value =0 ; ret =beiscsi_enable_pci (pcidev);
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -15898,7 +15898,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) {LIST_HEAD (completions);struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING ]; -struct lpfc_iocbq *piocbq =0 ; +struct lpfc_iocbq *piocbq =NULL ;unsigned long iflags =0 ;char *fail_msg =NULL ;struct lpfc_sglq *sglq;
drivers/scsi/mvumi.c +3 -3
@@ -606,7 +606,7 @@ static int mvumi_issue_blocked_cmd(struct mvumi_hba *mhba,spin_lock_irqsave (mhba->shost->host_lock, flags);atomic_dec (&cmd->sync_cmd);if (mhba->tag_cmd[cmd->frame->tag]) { - mhba->tag_cmd[cmd->frame->tag] =0 ; + mhba->tag_cmd[cmd->frame->tag] =NULL ;dev_warn (&mhba->pdev->dev,"TIMEOUT:release tag [%d]\n" , cmd->frame->tag);tag_release_one (mhba, &mhba->tag_pool, cmd->frame->tag);
@@ -1301,7 +1301,7 @@ static void mvumi_handle_clob(struct mvumi_hba *mhba) cmd = mhba->tag_cmd[ob_frame->tag];atomic_dec (&mhba->fw_outstanding); - mhba->tag_cmd[ob_frame->tag] =0 ; + mhba->tag_cmd[ob_frame->tag] =NULL ;tag_release_one (mhba, &mhba->tag_pool, ob_frame->tag);if (cmd->scmd)mvumi_complete_cmd (mhba, cmd, ob_frame);
@@ -1607,7 +1607,7 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd)spin_lock_irqsave (mhba->shost->host_lock, flags);if (mhba->tag_cmd[cmd->frame->tag]) { - mhba->tag_cmd[cmd->frame->tag] =0 ; + mhba->tag_cmd[cmd->frame->tag] =NULL ;tag_release_one (mhba, &mhba->tag_pool, cmd->frame->tag); }if (!list_empty (&cmd->queue_pointer))
drivers/scsi/pm8001/pm8001_init.c +1 -1
@@ -349,7 +349,7 @@ static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha) }else { pm8001_ha->io_mem[logicalBar].membase =0 ; pm8001_ha->io_mem[logicalBar].memsize =0 ; - pm8001_ha->io_mem[logicalBar].memvirtaddr =0 ; + pm8001_ha->io_mem[logicalBar].memvirtaddr =NULL ; } logicalBar++; }
drivers/scsi/pmcraid.c +1 -1
@@ -385,7 +385,7 @@ void pmcraid_init_cmdblk(struct pmcraid_cmd *cmd, int index) cmd->scsi_cmd =NULL ; cmd->release =0 ; cmd->completion_req =0 ; - cmd->sense_buffer =0 ; + cmd->sense_buffer =NULL ; cmd->sense_buffer_dma =0 ; cmd->dma_handle =0 ;init_timer (&cmd->timer);
drivers/scsi/qla2xxx/qla_nx.c +3 -3
@@ -4363,7 +4363,7 @@ qla82xx_md_free(scsi_qla_host_t *vha) ha->md_tmplt_hdr, ha->md_template_size / 1024);dma_free_coherent (&ha->pdev->dev, ha->md_template_size, ha->md_tmplt_hdr, ha->md_tmplt_hdr_dma); - ha->md_tmplt_hdr =0 ; + ha->md_tmplt_hdr =NULL ; }/* Release the template data buffer allocated */
@@ -4373,7 +4373,7 @@ qla82xx_md_free(scsi_qla_host_t *vha) ha->md_dump, ha->md_dump_size / 1024);vfree (ha->md_dump); ha->md_dump_size =0 ; - ha->md_dump =0 ; + ha->md_dump =NULL ; } }
@@ -4410,7 +4410,7 @@ qla82xx_md_prep(scsi_qla_host_t *vha)dma_free_coherent (&ha->pdev->dev, ha->md_template_size, ha->md_tmplt_hdr, ha->md_tmplt_hdr_dma); - ha->md_tmplt_hdr =0 ; + ha->md_tmplt_hdr =NULL ; } }
drivers/spi/spi-au1550.c +2 -2
@@ -333,7 +333,7 @@ static int au1550_spi_dma_rxtmp_alloc(struct au1550_spi *hw, unsigned size) size, DMA_FROM_DEVICE);if (dma_mapping_error (hw->dev, hw->dma_rx_tmpbuf_addr)) {kfree (hw->dma_rx_tmpbuf); - hw->dma_rx_tmpbuf =0 ; + hw->dma_rx_tmpbuf =NULL ; hw->dma_rx_tmpbuf_size =0 ;return -EFAULT ; }
@@ -345,7 +345,7 @@ static void au1550_spi_dma_rxtmp_free(struct au1550_spi *hw)dma_unmap_single (hw->dev, hw->dma_rx_tmpbuf_addr, hw->dma_rx_tmpbuf_size,DMA_FROM_DEVICE );kfree (hw->dma_rx_tmpbuf); - hw->dma_rx_tmpbuf =0 ; + hw->dma_rx_tmpbuf =NULL ; hw->dma_rx_tmpbuf_size =0 ; }
drivers/staging/comedi/drivers/jr3_pci.c +1 -1
@@ -896,7 +896,7 @@ static int jr3_pci_attach(struct comedi_device *dev, p->maxdata_list[56 ] =0xffff ; p->maxdata_list[57 ] =0xffff ;/* Channel specific range and maxdata */ - dev->subdevices[i].range_table =0 ; + dev->subdevices[i].range_table =NULL ; dev->subdevices[i].range_table_list p->range_table_list; dev->subdevices[i].maxdata =0 ;
drivers/staging/comedi/drivers/pcmmio.c +2 -2
@@ -1002,7 +1002,7 @@ static void pcmmio_stop_intr(struct comedi_device *dev, subpriv->dio.intr.enabled_mask =0 ; subpriv->dio.intr.active =0 ; - s->async->inttrig =0 ; + s->async->inttrig =NULL ; nports = subpriv->dio.intr.num_asic_chans /CHANS_PER_PORT ; firstport = subpriv->dio.intr.asic_chan /CHANS_PER_PORT ;switch_page (dev, asic,PAGE_ENAB );
@@ -1108,7 +1108,7 @@ pcmmio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,return -EINVAL ;spin_lock_irqsave (&subpriv->dio.intr.spinlock, flags); - s->async->inttrig =0 ; + s->async->inttrig =NULL ;if (subpriv->dio.intr.active) event =pcmmio_start_intr (dev, s);spin_unlock_irqrestore (&subpriv->dio.intr.spinlock, flags);
drivers/staging/comedi/drivers/pcmuio.c +2 -2
@@ -863,7 +863,7 @@ static void pcmuio_stop_intr(struct comedi_device *dev, subpriv->intr.enabled_mask =0 ; subpriv->intr.active =0 ; - s->async->inttrig =0 ; + s->async->inttrig =NULL ; nports = subpriv->intr.num_asic_chans /CHANS_PER_PORT ; firstport = subpriv->intr.asic_chan /CHANS_PER_PORT ;switch_page (dev, asic,PAGE_ENAB );
@@ -952,7 +952,7 @@ pcmuio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,return -EINVAL ;spin_lock_irqsave (&subpriv->intr.spinlock, flags); - s->async->inttrig =0 ; + s->async->inttrig =NULL ;if (subpriv->intr.active) event =pcmuio_start_intr (dev, s);
drivers/staging/comedi/drivers/s626.c +1 -1
@@ -2851,7 +2851,7 @@ static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, vpptr = pdma->PhysicalBase;if (vbptr) {pci_free_consistent (devpriv->pdev, bsize, vbptr, vpptr); - pdma->LogicalBase =0 ; + pdma->LogicalBase =NULL ; pdma->PhysicalBase =0 ; DEBUG("CloseDMAB(): Logical=%p, bsize=%d, Physical=0x%x\n",
drivers/staging/comedi/drivers/serial2002.c +3 -3
@@ -862,7 +862,7 @@ static int serial2002_attach(struct comedi_device *dev, s->subdev_flags =SDF_READABLE |SDF_GROUND ; s->n_chan =0 ; s->maxdata =1 ; - s->range_table =0 ; + s->range_table =NULL ; s->insn_read = &serial2002_ai_rinsn;/* analog output subdevice */
@@ -871,7 +871,7 @@ static int serial2002_attach(struct comedi_device *dev, s->subdev_flags =SDF_WRITEABLE ; s->n_chan =0 ; s->maxdata =1 ; - s->range_table =0 ; + s->range_table =NULL ; s->insn_write = &serial2002_ao_winsn; s->insn_read = &serial2002_ao_rinsn;
@@ -881,7 +881,7 @@ static int serial2002_attach(struct comedi_device *dev, s->subdev_flags =SDF_READABLE |SDF_LSAMPL ; s->n_chan =0 ; s->maxdata =1 ; - s->range_table =0 ; + s->range_table =NULL ; s->insn_read = &serial2002_ei_rinsn;return 1 ;
drivers/staging/cxt1e1/hwprobe.c +1 -1
@@ -163,7 +163,7 @@ prep_hdw_info (void) hi->pci_slot =0xff ; hi->pci_pin[0 ] =0 ; hi->pci_pin[1 ] =0 ; - hi->ndev =0 ; + hi->ndev =NULL ; hi->addr[0 ] =0L ; hi->addr[1 ] =0L ; hi->addr_mapped[0 ] =0L ;
drivers/staging/cxt1e1/linux.c +2 -2
@@ -251,7 +251,7 @@ c4_wq_port_cleanup (mpi_t * pi) {destroy_workqueue (pi->wq_port);/* this also calls * flush_workqueue() */ - pi->wq_port =0 ; + pi->wq_port =NULL ; } }
@@ -750,7 +750,7 @@ do_deluser (struct net_device * ndev, int lockit) ch =c4_find_chan (channum);if (ch =NULL )return -ENOENT ; - ch->user =0 ;/* will be freed, below */ + ch->user =NULL ;/* will be freed, below */ }if (lockit)
drivers/staging/cxt1e1/musycc.c +4 -4
@@ -829,7 +829,7 @@ musycc_init (ci_t * ci) { pi = &ci->port[gchan];OS_kfree (pi->reg); - pi->reg =0 ; + pi->reg =NULL ; }return ENOMEM ; }
@@ -1001,7 +1001,7 @@ musycc_bh_tx_eom (mpi_t * pi, int gchan)#endif /*** CONFIG_SBE_WAN256T3_NCOMM ***/ OS_mem_token_free_irq (md->mem_token); - md->mem_token =0 ; + md->mem_token =NULL ; } md->status =0 ;#ifdef RLD_TXFULL_DEBUG
@@ -1702,10 +1702,10 @@ musycc_chan_down (ci_t * dummy, int channum) }OS_kfree (ch->mdr); - ch->mdr =0 ; + ch->mdr =NULL ; ch->rxd_num =0 ;OS_kfree (ch->mdt); - ch->mdt =0 ; + ch->mdt =NULL ; ch->txd_num =0 ;musycc_update_timeslots (pi);
drivers/staging/cxt1e1/pmcc4_drv.c +5 -5
@@ -77,7 +77,7 @@ extern void *memset (void *s, int c, size_t n);#endif int drvr_state =SBE_DRVR_INIT ; -ci_t *c4_list =0 ; +ci_t *c4_list =NULL ;ci_t *CI ;/* dummy pointer to board ZEROE's data - * DEBUG USAGE */
@@ -838,7 +838,7 @@ c4_musycc_rw (ci_t * ci, struct c4_musycc_param * mcp) {mpi_t *pi;volatile u_int32_t *dph;/* hardware implemented register */ -u_int32_t *dpr =0 ;/* RAM image of registers for group command +u_int32_t *dpr =NULL ;/* RAM image of registers for group command * usage */ int offset = mcp->offset %0x800 ;/* group relative address * offset, mcp->portnum is
@@ -1399,7 +1399,7 @@ c4_chan_up (ci_t * ci, int channum) md->status =HOST_TX_OWNED ;/* Host owns TX descriptor ** CODING * NOTE: HOST_TX_OWNED = 0 so no need to * byteSwap */ - md->mem_token =0 ; + md->mem_token =NULL ; md->data =0 ;if (i = (txnum -1 )) {
@@ -1455,10 +1455,10 @@ errfree:OS_mem_token_free (ch->mdr[i].mem_token); }OS_kfree (ch->mdt); - ch->mdt =0 ; + ch->mdt =NULL ; ch->txd_num =0 ;OS_kfree (ch->mdr); - ch->mdr =0 ; + ch->mdr =NULL ; ch->rxd_num =0 ; ch->state =DOWN ;return ENOBUFS ;
drivers/staging/cxt1e1/sbecrc.c +1 -1
@@ -90,7 +90,7 @@ sbeCrc (u_int8_t *buffer, /* data buffer to crc */u_int32_t initialCrc,/* starting CRC */ u_int32_t *result) { - u_int32_t *tbl = 0; + u_int32_t *tbl = NULL;u_int32_t temp1, temp2, crc;/*
drivers/staging/cxt1e1/sbeid.c +1 -1
@@ -29,7 +29,7 @@char *sbeid_get_bdname (ci_t * ci) { -char *np =0 ; +char *np =NULL ;switch (ci->brd_id) {
drivers/staging/cxt1e1/sbeproc.c +1 -1
@@ -73,7 +73,7 @@ sbecom_proc_get_sbe_info (char *buffer, char **start, off_t offset, {hdw_info_t *hi = &hdw_info[ci->brdno]; -u_int8_t *bsn =0 ; +u_int8_t *bsn =NULL ;switch (hi->promfmt) {
drivers/staging/gma500/framebuffer.c +2 -2
@@ -111,7 +111,7 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)void psbfb_suspend (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
@@ -127,7 +127,7 @@ void psbfb_suspend(struct drm_device *dev)void psbfb_resume (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);console_lock ();
drivers/staging/iio/Documentation/iio_utils.h +2 -2
@@ -103,7 +103,7 @@ inline int iioutils_get_type(unsigned *is_signed,FILE *sysfsfp;int ret;DIR *dp; -char *scan_el_dir, *builtname, *builtname_generic, *filename =0 ; +char *scan_el_dir, *builtname, *builtname_generic, *filename =NULL ;char signchar, endianchar;unsigned padint;const struct dirent *ent;
@@ -172,7 +172,7 @@ inline int iioutils_get_type(unsigned *is_signed,fclose (sysfsfp);free (filename); - filename =0 ; + filename =NULL ; } error_free_filename:if (filename)
drivers/staging/line6/midi.c +1 -1
@@ -237,7 +237,7 @@ static void line6_midi_input_trigger(struct snd_rawmidi_substream *substream,if (up) line6->line6midi->substream_receive = substream;else - line6->line6midi->substream_receive =0 ; + line6->line6midi->substream_receive =NULL ; }static struct snd_rawmidi_ops line6_midi_output_ops = {
drivers/staging/media/cxd2099/cxd2099.c +1 -1
@@ -683,7 +683,7 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg,void *priv, struct i2c_adapter *i2c) { - struct cxd *ci = 0; + struct cxd *ci = NULL;u8 val;if (i2c_read_reg (i2c, cfg->adr,0 , &val) <0 ) {
drivers/staging/rtl8192u/r8192U_core.c +2 -2
@@ -2274,7 +2274,7 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) priv->oldaddr =NULL ;if (priv->pp_rxskb) {kfree (priv->pp_rxskb); - priv->pp_rxskb =0 ; + priv->pp_rxskb =NULL ; } }#else
@@ -2302,7 +2302,7 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) priv->oldaddr =NULL ;if (priv->pp_rxskb) {kfree (priv->pp_rxskb); - priv->pp_rxskb =0 ; + priv->pp_rxskb =NULL ; }
drivers/staging/sep/sep_driver.c +2 -2
@@ -1500,7 +1500,7 @@ static int sep_prepare_input_dma_table(struct sep_device *sep,/* Number of entries in lli table */ u32 num_entries_in_table =0 ;/* Next table address */ -void *lli_table_alloc_addr =0 ; +void *lli_table_alloc_addr =NULL ;dev_dbg (&sep->pdev->dev,"prepare intput dma table data_size is %x\n" , data_size);dev_dbg (&sep->pdev->dev,"block_size is %x\n" , block_size);
@@ -1671,7 +1671,7 @@ static int sep_construct_dma_tables_from_lli( u32 *table_data_size_ptr) {/* Points to the area where next lli table can be allocated */ -void *lli_table_alloc_addr =0 ; +void *lli_table_alloc_addr =NULL ;/* Input lli table */ struct sep_lli_entry *in_lli_table_ptr =NULL ;/* Output lli table */
drivers/tty/serial/68328serial.c +2 -2
@@ -74,7 +74,7 @@ static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS;m68328_uart *uart_addr = (m68328_uart *)USTCNT_ADDR ;struct tty_struct m68k_ttys; -struct m68k_serial *m68k_consinfo =0 ; +struct m68k_serial *m68k_consinfo =NULL ;#define M68K_CLOCK (16667000)/* FIXME: 16MHz is likely wrong */
@@ -427,7 +427,7 @@ static void shutdown(struct m68k_serial * info)if (info->xmit_buf) {free_page ((unsigned long ) info->xmit_buf); - info->xmit_buf =0 ; + info->xmit_buf =NULL ; }if (info->tty)
drivers/tty/serial/msm_smd_tty.c +1 -1
@@ -123,7 +123,7 @@ static void smd_tty_port_shutdown(struct tty_port *tport) info = tty->driver_data;if (info->ch) {smd_close (info->ch); - info->ch =0 ; + info->ch =NULL ; } tty->driver_data =0 ;
drivers/usb/gadget/f_mass_storage.c +4 -4
@@ -3184,10 +3184,10 @@ fsg_config_from_params(struct fsg_config *cfg, }/* Let MSF use defaults */ - cfg->lun_name_format =0 ; - cfg->thread_name =0 ; - cfg->vendor_name =0 ; - cfg->product_name =0 ; + cfg->lun_name_format =NULL ; + cfg->thread_name =NULL ; + cfg->vendor_name =NULL ; + cfg->product_name =NULL ; cfg->release =0xffff ; cfg->ops =NULL ;
drivers/usb/gadget/fsl_udc_core.c +1 -1
@@ -1972,7 +1972,7 @@ static int fsl_start(struct usb_gadget_driver *driver,ERR ("can't bind to transceiver\n" ); driver->unbind (&udc_controller->gadget); udc_controller->gadget.dev.driver =0 ; - udc_controller->driver =0 ; + udc_controller->driver =NULL ;return retval; } }
drivers/usb/gadget/s3c-hsudc.c +4 -4
@@ -815,7 +815,7 @@ static int s3c_hsudc_ep_disable(struct usb_ep *_ep)s3c_hsudc_nuke_ep (hsep, -ESHUTDOWN ); - hsep->desc =0 ; + hsep->desc =NULL ; hsep->stopped =1 ;spin_unlock_irqrestore (&hsudc->lock, flags);
@@ -905,12 +905,12 @@ static int s3c_hsudc_queue(struct usb_ep *_ep, struct usb_request *_req, csr =readl ((u32 )hsudc->regs + offset);if (!(csr &S3C_ESR_TX_SUCCESS ) && (s3c_hsudc_write_fifo (hsep, hsreq) =1 )) - hsreq =0 ; + hsreq =NULL ; }else { csr =readl ((u32 )hsudc->regs + offset);if ((csr &S3C_ESR_RX_SUCCESS ) && (s3c_hsudc_read_fifo (hsep, hsreq) =1 )) - hsreq =0 ; + hsreq =NULL ; } }
@@ -1004,7 +1004,7 @@ static void s3c_hsudc_initep(struct s3c_hsudc *hsudc, hsep->ep.maxpacket = epnum ?512 :64 ; hsep->ep.ops = &s3c_hsudc_ep_ops; hsep->fifo = hsudc->regs +S3C_BR (epnum); - hsep->desc =0 ; + hsep->desc =NULL ; hsep->stopped =0 ; hsep->wedge =0 ;
drivers/usb/host/ohci-omap.c +1 -1
@@ -301,7 +301,7 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver, struct platform_device *pdev) {int retval, irq; -struct usb_hcd *hcd =0 ; +struct usb_hcd *hcd =NULL ;struct ohci_hcd *ohci;if (pdev->num_resources !=2 ) {
drivers/usb/host/ohci-pnx4008.c +1 -1
@@ -294,7 +294,7 @@ static void pnx4008_unset_usb_bits(void)static int __devinit usb_hcd_pnx4008_probe (struct platform_device *pdev) { -struct usb_hcd *hcd =0 ; +struct usb_hcd *hcd =NULL ;struct ohci_hcd *ohci;const struct hc_driver *driver = &ohci_pnx4008_hc_driver;struct i2c_adapter *i2c_adap;
drivers/video/atafb.c +1 -1
@@ -1134,7 +1134,7 @@ static int falcon_decode_var(struct fb_var_screeninfo *var,/* Choose largest pixelclock <= wanted clock */ int i;unsigned long pcl =ULONG_MAX ; - pclock =0 ; + pclock =NULL ;for (i =1 ; i <=4 ; i *=2 ) {if (f25.t * i >= var->pixclock && f25.t * i < pcl) {
drivers/video/msm/mddi.c +2 -2
@@ -535,7 +535,7 @@ void mddi_remote_write(struct msm_mddi_client_data *cdata, uint32_t val, ll->data_count =4 ; ll->data = mddi->reg_write_addr + offsetof(struct mddi_llentry , u.r.register_data_list); - ll->next =0 ; + ll->next =NULL ; ll->reserved =0 ;mddi_writel (mddi->reg_write_addr,PRI_PTR );
@@ -572,7 +572,7 @@ uint32_t mddi_remote_read(struct msm_mddi_client_data *cdata, uint32_t reg) ll->header_count =14 ; ll->data_count =0 ; ll->data =0 ; - ll->next =0 ; + ll->next =NULL ; ll->reserved =0 ; s =mddi_readl (STAT );
drivers/video/msm/mddi_client_toshiba.c +1 -1
@@ -169,7 +169,7 @@ irqreturn_t toshiba_vsync_interrupt(int irq, void *data) panel->toshiba_got_int =1 ;if (panel->toshiba_callback) { panel->toshiba_callback->func (panel->toshiba_callback); - panel->toshiba_callback =0 ; + panel->toshiba_callback =NULL ; }wake_up (&toshiba_vsync_wait);return IRQ_HANDLED ;
drivers/video/msm/mdp.c +1 -1
@@ -284,7 +284,7 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb,int ret;unsigned long src_start =0 , src_len =0 , dst_start =0 , dst_len =0 ; struct mdp_info *mdp = container_of(mdp_dev, struct mdp_info, mdp_dev); -struct file *src_file =0 , *dst_file =0 ; +struct file *src_file =NULL , *dst_file =NULL ;/* WORKAROUND FOR HARDWARE BUG IN BG TILE FETCH */ if (unlikely(req->src_rect.h = 0 ||
drivers/video/pxa168fb.c +2 -2
@@ -602,8 +602,8 @@ static int __devinit pxa168fb_init_mode(struct fb_info *info,static int __devinit pxa168fb_probe (struct platform_device *pdev) {struct pxa168fb_mach_info *mi; -struct fb_info *info =0 ; -struct pxa168fb_info *fbi =0 ; +struct fb_info *info =NULL ; +struct pxa168fb_info *fbi =NULL ;struct resource *res;struct clk *clk;int irq, ret;
drivers/video/smscufx.c +2 -2
@@ -1144,7 +1144,7 @@ static void ufx_free_framebuffer_work(struct work_struct *work)fb_destroy_modelist (&info->modelist); - dev->info =0 ; + dev->info =NULL ;/* Assume info structure is freed after this point */ framebuffer_release (info);
@@ -1619,7 +1619,7 @@ static int ufx_usb_probe(struct usb_interface *interface, {struct usb_device *usbdev;struct ufx_data *dev; -struct fb_info *info =0 ; +struct fb_info *info =NULL ;int retval = -ENOMEM ;u32 id_rev, fpga_rev;
drivers/video/udlfb.c +7 -7
@@ -430,10 +430,10 @@ static void dlfb_compress_hline(while ((pixel_end > pixel) && (cmd_buffer_end -MIN_RLX_CMD_BYTES > cmd)) { -uint8_t *raw_pixels_count_byte =0 ; -uint8_t *cmd_pixels_count_byte =0 ; -const uint16_t *raw_pixel_start =0 ; -const uint16_t *cmd_pixel_start, *cmd_pixel_end =0 ; +uint8_t *raw_pixels_count_byte =NULL ; +uint8_t *cmd_pixels_count_byte =NULL ; +const uint16_t *raw_pixel_start =NULL ; +const uint16_t *cmd_pixel_start, *cmd_pixel_end =NULL ;prefetchw ((void *) cmd);/* pull in one cache line at least */
@@ -1158,7 +1158,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info)int new_len;unsigned char *old_fb = info->screen_base;unsigned char *new_fb; -unsigned char *new_back =0 ; +unsigned char *new_back =NULL ;pr_warn ("Reallocating framebuffer. Addresses will change!\n" );
@@ -1574,8 +1574,8 @@ static int dlfb_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) {struct usb_device *usbdev; -struct dlfb_data *dev =0 ; -struct fb_info *info =0 ; +struct dlfb_data *dev =NULL ; +struct fb_info *info =NULL ;int retval = -ENOMEM ;int i;
Re: [PATCH next V2] drivers: Use NULL not zero pointer assignments
Quoted 13 lines · Joe Perches
Using NULL pointer assignments is more kernel-style standard.
Uncompiled, untested.
Done via cocinelle script:
@@
type T;
T *pointer;
@@(quoted diff) +1
-1-pointer = 0 +pointer = NULL
Quoted 2 lines
Signed-off-by Joe Perches <[email protected]>---
Hi Joe,
I think you can drop a lot of the initialisations completely rather than convert them. I've pointed some out below. I'm just scanning through for likely candidates and I didn't bother looking at the staging drivers, so this list is not comprehensive.
~Ryan
<snip>
drivers/atm/ambassador.c static int __devinit ucode_init (loader_block * lb, amb_dev * dev) { · line 1925
Quoted 10 lines
drivers/atm/ambassador.c +1
-1@@ -1922,7 +1922,7 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {const struct firmware *fw;unsigned long start_address;const struct ihex_binrec *rec; -const char *errmsg =0 ; +const char *errmsg =NULL ;
This one looks like the assignment can just be dropped. errmsg is only used on the fail: exit path and errmsg gets assigned on all paths which goto there. Assuming gcc is smart enough to get this right, the initialisation here is not required.
Unrelated: What happened to the indentation in that file. How did it ever get passed review?
drivers/gpu/drm/gma500/framebuffer.c static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info) · line 118
Quoted 12 lines
drivers/gpu/drm/gma500/framebuffer.c +1
-1@@ -113,7 +113,7 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)void psbfb_suspend (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);
This code looks broken? to_psb_fb is defined as:
container_of(x, struct psb_framebuffer, base)
So passing a NULL fb is not useful. I think it can be fixed by not initialising either fb or psbfb, and then doing:
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
psbfb = to_psb_fb(fb);
...drivers/gpu/drm/gma500/framebuffer.c void psbfb_suspend(struct drm_device *dev) · line 133
Quoted 9 lines
drivers/gpu/drm/gma500/framebuffer.c +1
-1console_lock ();@@ -129,7 +129,7 @@ void psbfb_suspend(struct drm_device *dev)void psbfb_resume (struct drm_device *dev) { -struct drm_framebuffer *fb =0 ; +struct drm_framebuffer *fb =NULL ;struct psb_framebuffer *psbfb =to_psb_fb (fb);
Code looks broken in the same way as the psbfb_suspend function.
Quoted 18 lines
drivers/gpu/drm/nouveau/nv50_instmem.c +1
-1@@ -253,7 +253,7 @@ nv50_instmem_takedown(struct drm_device *dev)nouveau_gpuobj_ref (NULL , &priv->bar1_dmaobj);nouveau_vm_ref (NULL , &dev_priv->bar1_vm, chan->vm_pd); - dev_priv->channels.ptr[127 ] =0 ; + dev_priv->channels.ptr[127 ] =NULL ;nv50_channel_del (&dev_priv->channels.ptr[0 ]);nouveau_gpuobj_ref (NULL , &dev_priv->bar3_vm->pgt[0 ].obj[0 ]);drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0
-0
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c int vmw_framebuffer_create_handle(struct drm_framebuffer *fb, · line 381
Quoted 5 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-1@@ -378,7 +378,7 @@ int vmw_framebuffer_create_handle(struct drm_framebuffer *fb, unsigned int *handle) {if (handle) - handle =0 ; + handle =NULL ;
This doesn't do anything useful. I think maybe it is meant to be:
if (handle) *handle = 0;
Otherwise the whole function should just get removed.
Quoted 11 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0
-0return 0 ; }drivers/iommu/amd_iommu_init.c +0
-0
drivers/iommu/amd_iommu_init.c static int __init init_exclusion_range(struct ivmd_header *m) · line 1213
Quoted 5 lines
drivers/iommu/amd_iommu_init.c +1
-1@@ -1210,7 +1210,7 @@ static int __init init_exclusion_range(struct ivmd_header *m)/* called for unity map ACPI definition */ static int __init init_unity_map_range (struct ivmd_header *m) { -struct unity_map_entry *e =0 ; +struct unity_map_entry *e =NULL ;
This initialisation can be removed. e is immediately kzalloc'ed just below.
Quoted 9 lines
drivers/iommu/amd_iommu_init.c +0
-0char *s; e =kzalloc (sizeof (*e),GFP_KERNEL );drivers/media/video/hdpvr/hdpvr-core.c +0
-0
drivers/media/video/hdpvr/hdpvr-core.c static int hdpvr_probe(struct usb_interface *interface, · line 298
Quoted 5 lines
drivers/media/video/hdpvr/hdpvr-core.c +1
-1@@ -295,7 +295,7 @@ static int hdpvr_probe(struct usb_interface *interface, goto error; } - dev->workqueue =0 ; + dev->workqueue =NULL ;
This line can be removed. dev was kzalloc'ed just above so dev->workqueue is already NULL.
drivers/net/fddi/skfp/hwmtm.c static char const ID_sccs[] = "@(#)hwmtm.c 1.40 99/05/31 (C) SK" ; · line 50
Quoted 12 lines
drivers/net/fddi/skfp/hwmtm.c +2
-2@@ -46,8 +46,8 @@ static char const ID_sccs[] = "@(#)hwmtm.c 1.40 99/05/31 (C) SK" ;------------------------------------------------------------- */ #ifdef COMMON_MB_POOL -static SMbuf *mb_start =0 ; -static SMbuf *mb_free =0 ; +static SMbuf *mb_start =NULL ; +static SMbuf *mb_free =NULL ;
Drop the assignments here. These are globals, so already initialised to NULL.
Quoted 5 lines
drivers/scsi/be2iscsi/be_cmds.c +0
-0
drivers/scsi/be2iscsi/be_cmds.c line 27
Quoted 9 lines
drivers/scsi/be2iscsi/be_cmds.c +3
-3@@ -22,9 +22,9 @@int beiscsi_pci_soft_reset (struct beiscsi_hba *phba) {u32 sreset; -u8 *pci_reset_offset =0 ; -u8 *pci_online0_offset =0 ; -u8 *pci_online1_offset =0 ; +u8 *pci_reset_offset =NULL ; +u8 *pci_online0_offset =NULL ; +u8 *pci_online1_offset =NULL ;
Drop all of these. They all get re-assigned immediately below.
drivers/scsi/be2iscsi/be_cmds.c int beiscsi_pci_soft_reset(struct beiscsi_hba *phba) · line 77
Quoted 9 lines
drivers/scsi/be2iscsi/be_cmds.c +1
-1u32 pconline0 =0 ;u32 pconline1 =0 ;u32 i;@@ -74,7 +74,7 @@ int beiscsi_pci_soft_reset(struct beiscsi_hba *phba)int be_chk_reset_complete (struct beiscsi_hba *phba) {unsigned int num_loop; -u8 *mpu_sem =0 ; +u8 *mpu_sem =NULL ;
Same here. It gets assigned again unconditionally about 3 lines down.
drivers/scsi/be2iscsi/be_main.c static void beiscsi_quiesce(struct beiscsi_hba *phba) · line 4135
Quoted 13 lines
drivers/scsi/be2iscsi/be_cmds.c +0
-0u32 status; num_loop =1000 ;drivers/scsi/be2iscsi/be_main.c +1
-1@@ -4132,7 +4132,7 @@ static void beiscsi_quiesce(struct beiscsi_hba *phba)struct hwi_context_memory *phwi_context;struct be_eq_obj *pbe_eq;unsigned int i, msix_vec; -u8 *real_offset =0 ; +u8 *real_offset =NULL ;
This initialisation isn't needed. It gets assigned unconditionally in the code below before anything attempts to use it.
drivers/scsi/be2iscsi/be_main.c static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, · line 4232
Quoted 9 lines
drivers/scsi/be2iscsi/be_main.c +1
-1u32 value =0 ; phwi_ctrlr = phba->phwi_ctrlr;@@ -4229,7 +4229,7 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,struct hwi_context_memory *phwi_context;struct be_eq_obj *pbe_eq;int ret, num_cpus, i; -u8 *real_offset =0 ; +u8 *real_offset =NULL ;
Same here. Just remove the initialisation.
drivers/scsi/lpfc/lpfc_sli.c lpfc_drain_txq(struct lpfc_hba *phba) · line 15901
Quoted 13 lines
drivers/scsi/be2iscsi/be_main.c +0
-0u32 value =0 ; ret =beiscsi_enable_pci (pcidev);drivers/scsi/lpfc/lpfc_sli.c +1
-1@@ -15898,7 +15898,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) {LIST_HEAD (completions);struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING ]; -struct lpfc_iocbq *piocbq =0 ; +struct lpfc_iocbq *piocbq =NULL ;
Initialisation doesn't appear to be necessary.
drivers/scsi/lpfc/lpfc_sli.c lpfc_drain_txq(struct lpfc_hba *phba) · line 15904
Quoted 3 lines
drivers/scsi/lpfc/lpfc_sli.c +0
-0unsigned long iflags =0 ;char *fail_msg =NULL ;struct lpfc_sglq *sglq;
~Ryan
Re: [PATCH next V2] drivers: Use NULL not zero pointer assignments
Quoted 11 lines · Ryan Mallon
Review
Quoted 9 lines · Joe Perches
Using NULL pointer assignments is more kernel-style standard. Uncompiled, untested.
Done via cocinelle script:
@@
type T;
T *pointer;
@@(quoted diff) +1
-1-pointer = 0 +pointer = NULLHi Joe,
Hi Ryan.
Quoted 4 lines
I think you can drop a lot of the initialisations completely rather than convert them. I've pointed some out below. I'm just scanning through for likely candidates and I didn't bother looking at the staging drivers, so this list is not comprehensive.
I'll try a more generic solution.
Here's a possible cocci script that looks for declarations with initializations that are later overwritten.
$ cat multi_set.cocci @@ type T; identifier x; expression y; expression z; @@ -T x = y; +T x; ... x = z $
This script has a defect because expression z may
use identifier x.
Anyway, if the script can be tweaked appropriately, it might be useful to remove these unnecessary initializations.
cheers, Joe
Re: [PATCH next V2] drivers: Use NULL not zero pointer assignments
Quoted 14 lines · Joe Perches
Quoted 11 lines · Ryan Mallon
Review
Quoted 9 lines · Joe Perches
Using NULL pointer assignments is more kernel-style standard. Uncompiled, untested.
Done via cocinelle script:
@@
type T;
T *pointer;
@@(quoted diff) +1
-1-pointer = 0 +pointer = NULLHi Joe,
Hi Ryan.
Quoted 7 lines
Quoted 4 lines
I think you can drop a lot of the initialisations completely rather than convert them. I've pointed some out below. I'm just scanning through for likely candidates and I didn't bother looking at the staging drivers, so this list is not comprehensive.
I'll try a more generic solution.
Here's a possible cocci script that looks for declarations with initializations that are later overwritten.
I think you need to be careful with this. I don't know enough about Coccinelle, but in general control flow makes this a difficult problem. This are also the cases where a variable is assigned on all control paths before being used, but also has an (seemingly useless) initialiser because gcc occasionally cannot determine that the variable is always initialised (because in general it is undecidable) and so the initialisation is there to prevent a compiler warning.
There were also a couple of cases I pointed out where the assignment of zero to a pointer variable was actually masking some other bug, and so replacing the assignment with NULL, or removing the initialisation is not necessarily the correct fix.
A script might be useful for identifying potential cases, but I think it is worth looking at each one individually to determine what the correct fix is.
~Ryan
Quoted 22 lines
$ cat multi_set.cocci @@ type T; identifier x; expression y; expression z; @@(quoted diff) +1
-1-T x = y; +T x;x = z
$This script has a defect because expression z may
use identifier x.Anyway, if the script can be tweaked appropriately, it might be useful to remove these unnecessary initializations.
cheers, Joe
Re: [PATCH next V2] drivers: Use NULL not zero pointer assignments
Quoted 23 lines · Ryan Mallon
Quoted 14 lines · Joe Perches
Quoted 11 lines · Ryan Mallon
Review
Quoted 9 lines · Joe Perches
Using NULL pointer assignments is more kernel-style standard. Uncompiled, untested.
Done via cocinelle script:
@@
type T;
T *pointer;
@@(quoted diff) +1
-1-pointer = 0 +pointer = NULLHi Joe,
Hi Ryan.
Quoted 7 lines
Quoted 4 lines
I think you can drop a lot of the initialisations completely rather than convert them. I've pointed some out below. I'm just scanning through for likely candidates and I didn't bother looking at the staging drivers, so this list is not comprehensive.
I'll try a more generic solution.
Here's a possible cocci script that looks for declarations with initializations that are later overwritten.
Quoted 7 lines
I think you need to be careful with this. I don't know enough about Coccinelle, but in general control flow makes this a difficult problem. This are also the cases where a variable is assigned on all control paths before being used, but also has an (seemingly useless) initialiser because gcc occasionally cannot determine that the variable is always initialised (because in general it is undecidable) and so the initialisation is there to prevent a compiler warning.
Coccinelle follows control-flow paths. But it is not likely to be more clever about this than gcc. It is unaware of the value of anything, so it does not realize that some control-flow paths are impossible. So I don't think there would be big problems here.
Quoted 4 lines
There were also a couple of cases I pointed out where the assignment of zero to a pointer variable was actually masking some other bug, and so replacing the assignment with NULL, or removing the initialisation is not necessarily the correct fix.
But in this case it doesn't seem like it would hurt? Having 0 or NULL would probably not make someone more or less likely to think about the function as a whole?
For example, in the container_of case, having NULL is probably better than 0, because someone else is more likely to look for container_of's of NULL than container_of's of 0.
On the other hand, converting the 0 to NULL in the handle/*handle case might indeed hurt subsequent debuggability.
Quoted 3 lines
A script might be useful for identifying potential cases, but I think it is worth looking at each one individually to determine what the correct fix is.
100% agreed on this point :)
julia
Re: [PATCH next V2] drivers: Use NULL not zero pointer assignments
Quoted 25 lines · Julia Lawall
Quoted 23 lines · Ryan Mallon
Quoted 21 lines · Joe Perches
Quoted 11 lines · Ryan Mallon
Review
Quoted 9 lines · Joe Perches
Using NULL pointer assignments is more kernel-style standard. Uncompiled, untested.
Done via cocinelle script:
@@
type T;
T *pointer;
@@(quoted diff) +1
-1-pointer = 0 +pointer = NULLHi Joe,
Hi Ryan.
Quoted 4 lines
I think you can drop a lot of the initialisations completely rather than convert them. I've pointed some out below. I'm just scanning through for likely candidates and I didn't bother looking at the staging drivers, so this list is not comprehensive.
I'll try a more generic solution.
Here's a possible cocci script that looks for declarations with initializations that are later overwritten.
Quoted 7 lines
Quoted 1 line
I think you need to be careful with this. I don't know enough about Coccinelle, but in general control flow makes this a difficult problem. This are also the cases where a variable is assigned on all control paths before being used, but also has an (seemingly useless) initialiser because gcc occasionally cannot determine that the variable is always initialised (because in general it is undecidable) and so the initialisation is there to prevent a compiler warning.
Coccinelle follows control-flow paths. But it is not likely to be more clever about this than gcc. It is unaware of the value of anything, so it does not realize that some control-flow paths are impossible. So I don't think there would be big problems here.
Quoted 1 line
There were also a couple of cases I pointed out where the assignment of zero to a pointer variable was actually masking some other bug, and so replacing the assignment with NULL, or removing the initialisation is not necessarily the correct fix.
But in this case it doesn't seem like it would hurt? Having 0 or NULL would probably not make someone more or less likely to think about the function as a whole?
The reason not to do this is because it is just code churn: Replacing broken code with code that is broken in a slightly different way is not particularly constructive.
Quoted 2 lines
For example, in the
container_ofcase, having NULL is probably better than 0, because someone else is more likely to look for container_of's of NULL than container_of's of 0.
Possibly, I think it should be obvious in either case though that the code is probably not correct and needs to be fixed correctly.
~Ryan
A message that is not in the archive (sent off-list or not yet received): [email protected]
Samuel Ortiz
Acked-byHi Dan,
Quoted 5 lines · Dan Carpenter
This is a pointer so it should be NULL instead of zero. Sparse complains about this stuff:
net/nfc/nci/core.c:447:37: warning: Using plain integer as NULL pointerSigned-off-by Dan Carpenter <[email protected]>
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/