From patchwork Fri Jan 13 17:09:52 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: 9516029 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 DFC3760762 for ; Fri, 13 Jan 2017 17:10:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEB9228761 for ; Fri, 13 Jan 2017 17:10:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C080728762; Fri, 13 Jan 2017 17:10:24 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6216128762 for ; Fri, 13 Jan 2017 17:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751117AbdAMRKP (ORCPT ); Fri, 13 Jan 2017 12:10:15 -0500 Received: from mout.web.de ([212.227.17.12]:50839 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbdAMRKN (ORCPT ); Fri, 13 Jan 2017 12:10:13 -0500 Received: from [192.168.1.2] ([78.49.203.248]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M0hfO-1cjKzo1vGI-00us4t; Fri, 13 Jan 2017 18:10:06 +0100 Subject: [PATCH 02/17] spi: Adjust checks for null pointers in two functions To: linux-spi@vger.kernel.org, Mark Brown References: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <1e19b52a-119a-d52c-3a54-0a533ac5b6db@users.sourceforge.net> Date: Fri, 13 Jan 2017 18:09:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> X-Provags-ID: V03:K0:Cpysej9o8S2+pRmMLec6N7zwGuNcpgW16X/9wI7G9xLl6lq57sK SgEyhZ9w4l84at6O1+Xxnv6Z+G9Z6MTyCXzZM+L0h7w55FXv1iX+AHrWuDuKLE6P6yGyI7C Stn6Pgefx78r1OmJzHEKpp6yKegq8i7n+2QngOTHy9b6NGx3T1cNdK/qfDH+SNhWv4A1lds Av71zWPf54ez6ATvZHuEQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:DAfutXnWelk=:mLLiwiA+5RCCWs/bJHUomC X8+/w0PyKfIjwoWZoCb3nbXY9NhahDbCDJblLvWrKhUoOnbWpxOozSxDMwEr/QIQGhCsd451t iSt6ZTkLuRfpVicANzUxIzMKBVH3TG90iVnlvUBbiuH8utkwtuPW/aoD5y8iWDfHK0V22/Jv4 ANaYWONQSvtSLu1VKcrBsFmRfesRH0ivzp42NmpeGRMFCpZYq9E38b5FWbhBKY4WAa0GFxE+O fYrcS3vTkV1PZtJDdWOgL1UraRJjwWuFwjaV1TnGEDz8Gux/ZfkD9lohTjBNBoJ1vASXIoQ1f pDb8iCV0nk1btzEFn0ntEE1YAsh6jjJTnySVLGeyPa8hDss8YawUe0OOxP22E+/jtuYtmTLiQ Z0Oos3av0EGM4HCk64lGeQAbgMhUEo1wko537rX+30h2kyC0F3Dw3izvNmr6EOkA/3werdRUF pUNkKkRQt0QAygcYkBJ++8lLRr8xdqoWUpk8aoOBqvhHtEmakghyAn8pfxQH1KOY5Ac+X2WGj LHQieVu5rPFruKCDc1/RTMsjvWPUcDCty4j5OjBWHzRw5c0WpvL1YCjkC1OOTecd6uNSBsR97 CX3UIB4bmWh2u+hoBM79dSlOc6JiMoQDruEUzxkYQtcgv4WDMs59HaUxkh3yN4zSHeJnt2rkm HfTvTHzYENHKkn6BBGiENIVC/mSMSTSfceGtBf7wioDAe4bJIg3E/KVPNzvZSQHzSPj/jfvnH miS7codRzwTM9nbnGZll6lns9TYCxDsHroEh4TvdoD1VT05lF6pzTDuUzFB3IzreS2p47qQNH LO4CCZq Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 13 Jan 2017 13:23:32 +0100 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/spi/spi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 8c05f27bf642..d8d273545e54 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -816,7 +816,7 @@ static int __spi_map_msg(struct spi_master *master, struct spi_message *msg) if (!master->can_dma(master, msg->spi, xfer)) continue; - if (xfer->tx_buf != NULL) { + if (xfer->tx_buf) { ret = spi_map_buf(master, tx_dev, &xfer->tx_sg, (void *)xfer->tx_buf, xfer->len, DMA_TO_DEVICE); @@ -824,7 +824,7 @@ static int __spi_map_msg(struct spi_master *master, struct spi_message *msg) return ret; } - if (xfer->rx_buf != NULL) { + if (xfer->rx_buf) { ret = spi_map_buf(master, rx_dev, &xfer->rx_sg, xfer->rx_buf, xfer->len, DMA_FROM_DEVICE); @@ -3133,7 +3133,7 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action, switch (of_reconfig_get_state_change(action, arg)) { case OF_RECONFIG_CHANGE_ADD: master = of_find_spi_master_by_node(rd->dn->parent); - if (master == NULL) + if (!master) return NOTIFY_OK; /* not for us */ if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) { @@ -3159,7 +3159,7 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action, /* find our device by node */ spi = of_find_spi_device_by_node(rd->dn); - if (spi == NULL) + if (!spi) return NOTIFY_OK; /* no? not meant for us */ /* unregister takes one ref away */