From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752658AbdHIIEp (ORCPT ); Wed, 9 Aug 2017 04:04:45 -0400 Received: from mout.web.de ([212.227.17.11]:57454 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752159AbdHIIEn (ORCPT ); Wed, 9 Aug 2017 04:04:43 -0400 Subject: [PATCH 3/4] ALSA: emux: Adjust four checks for null pointers From: SF Markus Elfring To: alsa-devel@alsa-project.org, Jaroslav Kysela , Kees Cook , Takashi Iwai , Takashi Sakamoto Cc: LKML , kernel-janitors@vger.kernel.org References: <412aa3a5-c8b6-c1fe-febb-0d62927dacc2@users.sourceforge.net> Message-ID: Date: Wed, 9 Aug 2017 10:03:51 +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: <412aa3a5-c8b6-c1fe-febb-0d62927dacc2@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:/XTFWOI0o+Nh8LISsYvlqNp56jkF63pgAZ8j1owrVWfu6FNm2kK o6cSCfOJg6nzj1NLQFlvVoCGbJx3oFo99xHXoGay/B4nMAi+NFTGPl4MJlmPnlXHG+WGSo+ btFctsv4X+PZUJbJVjYuWVfcrpJliJ6n9IB5Z8dlnyxWpB1vtMeijGUbhHmjGa4GtX2l/6s s0CYT7+hG6QXqPsw7Q5RA== X-UI-Out-Filterresults: notjunk:1;V01:K0:S8Vbr63JkXk=:jnN4z3LhiImkc92kgnKZcN 4ZhO8zUmgS3U6M+QtbzTR3zuHziXzxZCHWk0OfpUAB6+7C0zyQMt7wKY0pFSRMyDyTLQm+DB9 2NgRF2KbuxqBVtTX3if74MKYLFpVQmh5TcO83UPII0xce27jaewTm01nukJWKEtpFG2bdx6Uy EQJYIkjII+j5viitrOtzZhGXtDQGD4QNoRfh/8FiDHaRCF6r5R32Gb4fZjQyQgYp3VKIsUnsC JBJNGfW/1H1+8eTImTzh8QyZ0gXCol15CAKw1tg91RMZwziK9gKQz5/AaUXqcgttE/3hoisAo 2e8CWu4F+FnRE29C3iUTYDJBxDjLJmG1+0b+lBQHkypdK0n4xmp2eyd/2hZT3OQS4wKmcAT/2 xzrkY97vIzHFC8ZUOcJ1Xs1TAuKkQHJwM72iVqDKfSG9wy1KsVn4PsnTb9aq/yJBBEvkSgnil J9xkULZQF5K4+loEflQ+C4ytRVJLWamV4WosiWK4QLCsU+pZ+pVqpaWbUSgqSVVGN1niOimzd ZlFpWXF2QhohFYDnXzgHPFNRlNhJxmei/niOSWT9ozFv2VjGrmXKuWSeY7eGvFg2INYjDUFXJ TXh7KlUUnt22mRhc1oGHJn0fHfGT7lBwlnxbez9y/sdSJe2tQIRcOm2tql0fB3AkPFsBpesGw X7SkeXw6p2+5K/eWasVvAREHACU7CoU1WAXdOyUG5FXqL87RyCV7mFzOzhddABrzo4+hBgjUa yW67wDcsPLYJq8aWFAxi+sqdwpCyGJT9YGu1CXzhXcznSa/H8RCp1Enw2zt/4C/fSFesccM77 yG1BGRLa9fL07Ne3whkmv1QuDghYnavBx02velbDrm6ceM0RyE= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Wed, 9 Aug 2017 09:22:42 +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 affected source code places. Signed-off-by: Markus Elfring --- sound/synth/emux/emux_seq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index 12acf18c5be4..fd6cbd439511 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c @@ -99,7 +99,7 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index) sprintf(tmpname, "%s Port %d", emu->name, i); p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS, 0, &pinfo); - if (p == NULL) { + if (!p) { snd_printk(KERN_ERR "can't create port\n"); return -ENOMEM; } @@ -151,7 +151,7 @@ snd_emux_create_port(struct snd_emux *emu, char *name, } p->chset.channels = kcalloc(max_channels, sizeof(*p->chset.channels), GFP_KERNEL); - if (p->chset.channels == NULL) { + if (!p->chset.channels) { snd_printk(KERN_ERR "no memory\n"); kfree(p); return NULL; @@ -373,7 +373,7 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card) return 0; emu->vmidi = kcalloc(emu->midi_ports, sizeof(*emu->vmidi), GFP_KERNEL); - if (emu->vmidi == NULL) + if (!emu->vmidi) return -ENOMEM; for (i = 0; i < emu->midi_ports; i++) { @@ -405,7 +405,7 @@ int snd_emux_delete_virmidi(struct snd_emux *emu) { int i; - if (emu->vmidi == NULL) + if (!emu->vmidi) return 0; for (i = 0; i < emu->midi_ports; i++) { -- 2.13.4