fs/ocfs2/aops.c:1881:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

From: kbuild test robot
Date: Mon Mar 28 2016 - 13:14:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f55532a0c0b8bb6148f4e07853b876ef73bc69ca
commit: 4506cfb6f8cad594ac73e0df2b2961ca10dbd25e ocfs2: record UNWRITTEN extents when populate write desc
date: 3 days ago


coccinelle warnings: (new ones prefixed by >>)

>> fs/ocfs2/aops.c:1881:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

vim +1881 fs/ocfs2/aops.c

1865 ret = -ENOMEM;
1866 goto out;
1867 }
1868 goto retry;
1869 }
1870 /* This direct write will doing zero. */
1871 new->ue_cpos = desc->c_cpos;
1872 new->ue_phys = desc->c_phys;
1873 desc->c_clear_unwritten = 0;
1874 list_add_tail(&new->ue_ip_node, &oi->ip_unwritten_list);
1875 list_add_tail(&new->ue_node, &wc->w_unwritten_list);
1876 new = NULL;
1877 unlock:
1878 spin_unlock(&oi->ip_lock);
1879 out:
1880 if (new)
> 1881 kfree(new);
1882 return ret;
1883 }
1884
1885 /*
1886 * Populate each single-cluster write descriptor in the write context
1887 * with information about the i/o to be done.
1888 *
1889 * Returns the number of clusters that will have to be allocated, as

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation