Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d37b1d99 authored by Markus Elfring's avatar Markus Elfring Committed by Ilya Dryomov
Browse files

ceph: adjust 36 checks for NULL pointers



The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written ...

Thus fix the affected source code places.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Reviewed-by: default avatarYan, Zheng <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent b529d1b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -540,7 +540,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)

	/* verify this is a writeable snap context */
	snapc = page_snap_context(page);
	if (snapc == NULL) {
	if (!snapc) {
		dout("writepage %p page %p not dirty?\n", inode, page);
		return 0;
	}
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);

	/* No caching for filesystem */
	if (fsc->fscache == NULL)
	if (!fsc->fscache)
		return;

	/* Only cache for regular files that are read only */
+2 −2
Original line number Diff line number Diff line
@@ -611,7 +611,7 @@ void ceph_add_cap(struct inode *inode,
	}

	if (flags & CEPH_CAP_FLAG_AUTH) {
		if (ci->i_auth_cap == NULL ||
		if (!ci->i_auth_cap ||
		    ceph_seq_cmp(ci->i_auth_cap->mseq, mseq) < 0) {
			ci->i_auth_cap = cap;
			cap->mds_wanted = wanted;
@@ -728,7 +728,7 @@ static void __touch_cap(struct ceph_cap *cap)
	struct ceph_mds_session *s = cap->session;

	spin_lock(&s->s_cap_lock);
	if (s->s_cap_iterator == NULL) {
	if (!s->s_cap_iterator) {
		dout("__touch_cap %p cap %p mds%d\n", &cap->ci->vfs_inode, cap,
		     s->s_mds);
		list_move_tail(&cap->session_caps, &s->s_caps);
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ static int mdsmap_show(struct seq_file *s, void *p)
	struct ceph_fs_client *fsc = s->private;
	struct ceph_mdsmap *mdsmap;

	if (fsc->mdsc == NULL || fsc->mdsc->mdsmap == NULL)
	if (!fsc->mdsc || !fsc->mdsc->mdsmap)
		return 0;
	mdsmap = fsc->mdsc->mdsmap;
	seq_printf(s, "epoch %d\n", mdsmap->m_epoch);
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
		dout("init_file %p %p 0%o (regular)\n", inode, file,
		     inode->i_mode);
		cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
		if (cf == NULL) {
		if (!cf) {
			ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
			return -ENOMEM;
		}
Loading