From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752286AbdHLPgn (ORCPT ); Sat, 12 Aug 2017 11:36:43 -0400 Received: from mout.web.de ([212.227.17.11]:52441 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750973AbdHLPgl (ORCPT ); Sat, 12 Aug 2017 11:36:41 -0400 Subject: [PATCH 3/3] ALSA: rme9652: Adjust seven checks for null pointers From: SF Markus Elfring To: alsa-devel@alsa-project.org, Arnd Bergmann , Colin Ian King , Jaroslav Kysela , Julia Lawall , Takashi Iwai , Takashi Sakamoto Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <10358741-a748-1e48-7508-2aff911bbee5@users.sourceforge.net> Date: Sat, 12 Aug 2017 17:35:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:DvsEitWXwlKld92kktzHO0hmSQGuop015voSb6SYJ7AhxgcVNew 6E4TC+uggMLOLguhvnf79hz7nPpj1byqvKvS7Jh8H8bkG2fFIsY5Y5ayMEikaGBgqOkPQbk +tA2RqkjHiyMgdy8r/4QRN841aiVdf4CChoaKzfYR5OICr7912y1pdV+fL6sbEgtAGQL8vo NKX6Hmld2jNUYG7KJdYlA== X-UI-Out-Filterresults: notjunk:1;V01:K0:m6qOFdx63eU=:144361ASaaUICbV2Ffd4SB ErlFC/URW6hEFcYVWs6MHawJ+oQeXpo0mRF9OeGM7cXDoR5IdJ43TkAClTi+wpcPRErAcj4nN TjLwd7nI5XGWv05FjpVXVWwp59TRJ6yu7fMsIb8F+lLu3gGzFjQ56DiO0PStNgS04LbNXnwT/ o69+c56CTISg85fmYvhDqVIUdA1u8pJuTY1uEkipAdxg46onD8bkw7A9+C9v1lTAEJh/g65bo dKgsAZXtJrtFN4scX3sF3kTemHil0t2sF0eir18ayLH5jv+h8wjgpK9mQI3/ujbirgVxHeIRv NjacNQH2Z+Z1ynZ82cgxhSjQoApU0MYPSNb0w7EjvTDqYd3XkwnUUtp2yqQP9PoyvJvwUFyZQ Zsmt0ugf8y6tjnAcvTVNCzYy0PPKaCGC+5TFcG9YTAXXy0FPL+m3r3HS3lfBHYZ5iF2DE3S2e N2DqwJvJi4Dlp0JsnVR+cjAzGI1O1biqRrpUVcqsozd+MQHpC6FsYu7fipZWw+vM/cMfxOxhZ 5WbUhT/71+cbuBOBWrmBjy+m3BlhBq7tsJxF3T9/RcrCtGN3EwQMHUcRwDR3X/jgZEao/tX8O ymEoCN+F9hJADV3ts+vabiRmuh6A1SK3V0SglOLPaQysnjGT16r/3ImTvTuLNDcOowzo8pPt8 HujJGa9qWhzhij297tQn0rfQMhslcs3m7YT4wtLR7+l7iFk4H5Rkaoj8TgXP8LJzVmpKSo9D9 i5uqJvkAi7hKj89WpOTKSEbY96CQx1uSUejvthHos7uScgs4JniM8DguVbzWnEehoYqqRKCPY GiClQzITTSiW/piDgv43SR2Dp9hG11H6uNVLZLvxYUMp04JCF0= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Sat, 12 Aug 2017 17:07:09 +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 --- sound/pci/rme9652/hdspm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 8d339fb7c24b..25284d8d9758 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1521,7 +1521,7 @@ static void hdspm_silence_playback(struct hdspm *hdspm) int n = hdspm->period_bytes; void *buf = hdspm->playback_buffer; - if (buf == NULL) + if (!buf) return; for (i = 0; i < HDSPM_MAX_CHANNELS; i++) { @@ -4706,7 +4706,7 @@ static int snd_hdspm_create_controls(struct snd_card *card, break; } - if (NULL != list) { + if (list) { for (idx = 0; idx < limit; idx++) { err = snd_ctl_add(card, snd_ctl_new1(&list[idx], hdspm)); @@ -6069,13 +6069,13 @@ static int snd_hdspm_open(struct snd_pcm_substream *substream) snd_hdspm_capture_subinfo; if (playback) { - if (hdspm->capture_substream == NULL) + if (!hdspm->capture_substream) hdspm_stop_audio(hdspm); hdspm->playback_pid = current->pid; hdspm->playback_substream = substream; } else { - if (hdspm->playback_substream == NULL) + if (!hdspm->playback_substream) hdspm_stop_audio(hdspm); hdspm->capture_pid = current->pid; @@ -6775,9 +6775,9 @@ static int snd_hdspm_create(struct snd_card *card, HDSPM_s2_tco_detect) { hdspm->midiPorts++; hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); - if (NULL != hdspm->tco) { + if (hdspm->tco) hdspm_tco_write(hdspm); - } + dev_info(card->dev, "AIO/RayDAT TCO module found\n"); } else { hdspm->tco = NULL; @@ -6789,9 +6789,9 @@ static int snd_hdspm_create(struct snd_card *card, if (hdspm_read(hdspm, HDSPM_statusRegister) & HDSPM_tco_detect) { hdspm->midiPorts++; hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); - if (NULL != hdspm->tco) { + if (hdspm->tco) hdspm_tco_write(hdspm); - } + dev_info(card->dev, "MADI/AES TCO module found\n"); } else { hdspm->tco = NULL; @@ -6868,7 +6868,7 @@ static int snd_hdspm_create(struct snd_card *card, * this case, we don't set card->id to avoid collisions * when running with multiple cards. */ - if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { + if (!id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { snprintf(card->id, sizeof(card->id), "HDSPMx%06x", hdspm->serial); snd_card_set_id(card, card->id); -- 2.14.0