From patchwork Mon May 1 16:49:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9706727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7866E602B5 for ; Mon, 1 May 2017 16:55:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69ABE2807E for ; Mon, 1 May 2017 16:55:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E88D280FC; Mon, 1 May 2017 16:55:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 25EC82807E for ; Mon, 1 May 2017 16:55:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DA0289F73; Mon, 1 May 2017 16:55:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.15.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1946E89F73 for ; Mon, 1 May 2017 16:55:03 +0000 (UTC) Received: from [192.168.1.2] ([77.181.166.232]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MDg8k-1dIy1l1hlu-00HAZc; Mon, 01 May 2017 18:49:39 +0200 Subject: [PATCH 4/4] drm/dp: Adjust four checks for null pointers From: SF Markus Elfring To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Jani Nikula , Sean Paul References: <1949e36b-5039-a7b6-5774-6ada7eb05ea6@users.sourceforge.net> Message-ID: <311ce726-9941-9040-1368-cdd556f41e73@users.sourceforge.net> Date: Mon, 1 May 2017 18:49:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <1949e36b-5039-a7b6-5774-6ada7eb05ea6@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:1rQcMh8ShMh2dQ97qIDPuzLrqVkk3XLdgAv2OtzQ13aYNcsuiKl nbAybGDylnVh48S00irAd2esH8/8huKes2Fnp17zMy4ExnNqJvRWtRqtYwZumIcTFQ3CaSn /bMeNqs75XNgw04xZcaSMrzlsVwvGcxdA9OXcsGLdCK9tVjB3fehDhUAN0ysJXI2rsOQ3Tg NlnGkhS6uQSZ8RwXwHhuQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Xpgmza/OPHU=:vZNMNE7VageOQAsSLuQZN3 w2ZdB2rTK4IDkIM55yr2OFH3I8FP2xBM269XXN3jQ2haS05Ldsj6jpXFaVpY2dK5+UM6S3lBg 35LYq/bgQSUAmUsxryQOrV5uPU9JbzGdAIhyhTobhZxBu+F30x2tpUJgIrP6+MqumQ69svfGc WiWRD4SZq/SPc1DeXrqjLOqkaQPUnLz5p7Kip/9g5mSkiTGt974vU5YEKDPdRDwm3lfHgbhZt +9jdDmMmF5CfaN5K8vpv+lXwFgwN8++9M17zcNdM0QsJt9MvMww3Uqsxvd7y8IqoVlyxvjEgQ rh+J9aAaGUZt37uqbs3+4LR3iDjiN6d6g/3Ft1HcGDvcH6sa+XGF73+0Cscp0NcTo/QdtdB1F vQFA/2+bUu3rYHFKV4E7pQ5IawANXNvVV2A77s7GKtz8rOLs2d91YzNmM2q2t0wircP4ZUilj RuA6iE5Ha5700wXwPszeEW3vUjnt5NW837lXDmnLwG55aBV8iXSxEH7gTnoyNFyezMeZSOtD9 W+SlVUvauNZ3YpWyzNaH6Pot0D5okzX9hRxNWS975KLyEXfW5sRNv3KtE8au72tVnN9ZURysR bJyqqjLKgJnR1G0NV6ejXe02BKcyeguKhnQfDkEAgCcOUx+zj/8ENj9MT8I/irJPUZLP9POWu QhXrc0D57zVWNrSPhabmaFYHQUkcfItRBp0XyZeERok2uAM/Ah/ARFnFXnOhfKRv40W8PQCaY 2VixS/BHkFbThQF0XqHVhNZsXnaCn5i8B/ap3pifTZDp2uSmzS0dkrSWQ/jE2yTxlduBlwvl3 ZeeRNQu Cc: kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- 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; }