linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>,
	David Airlie <airlied@linux.ie>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 4/4] drm/dp: Adjust four checks for null pointers
Date: Mon, 1 May 2017 18:49:36 +0200	[thread overview]
Message-ID: <311ce726-9941-9040-1368-cdd556f41e73@users.sourceforge.net> (raw)
In-Reply-To: <1949e36b-5039-a7b6-5774-6ada7eb05ea6@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 1 May 2017 18:22:52 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index bcc76f15f1ce..f46bf5101d14 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1405,13 +1405,12 @@ static int set_hdr_from_dst_qlock(struct drm_dp_sideband_msg_hdr *hdr,
 			DRM_DEBUG_KMS("%s: failed to find slot\n", __func__);
 			return -EAGAIN;
 		}
-		if (mstb->tx_slots[0] == NULL && mstb->tx_slots[1] == NULL) {
+		if (!mstb->tx_slots[0] && !mstb->tx_slots[1]) {
 			txmsg->seqno = mstb->last_seqno;
 			mstb->last_seqno ^= 1;
-		} else if (mstb->tx_slots[0] == NULL)
-			txmsg->seqno = 0;
-		else
-			txmsg->seqno = 1;
+		} else {
+			txmsg->seqno = mstb->tx_slots[0] ? 1 : 0;
+		}
 		mstb->tx_slots[txmsg->seqno] = txmsg;
 	}
 
@@ -2044,7 +2043,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
 
 		/* add initial branch device at LCT 1 */
 		mstb = drm_dp_add_mst_branch_device(1, NULL);
-		if (mstb == NULL) {
+		if (!mstb) {
 			ret = -ENOMEM;
 			goto out_unlock;
 		}
-- 
2.12.2

      parent reply	other threads:[~2017-05-01 16:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01 16:45 [PATCH 0/4] drm/dp: Fine-tuning for three function implementations SF Markus Elfring
2017-05-01 16:46 ` [PATCH 1/4] drm/dp: Use seq_putc() in drm_dp_mst_dump_topology() SF Markus Elfring
2017-05-01 17:11   ` Joe Perches
2017-05-01 16:47 ` [PATCH 2/4] drm/dp: Combine two seq_printf() calls into one call " SF Markus Elfring
2017-05-01 16:48 ` [PATCH 3/4] drm/dp: Replace six seq_printf() calls by seq_puts() " SF Markus Elfring
2017-05-01 16:49 ` SF Markus Elfring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=311ce726-9941-9040-1368-cdd556f41e73@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanpaul@chromium.org \
    --subject='Re: [PATCH 4/4] drm/dp: Adjust four checks for null pointers' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).