From patchwork Wed Aug 23 08:29: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: 9916835 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 BAFC7600C5 for ; Wed, 23 Aug 2017 08:30:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABF6526E3A for ; Wed, 23 Aug 2017 08:30:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A09D42896D; Wed, 23 Aug 2017 08:30:04 +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=-1.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAE6C26E3A for ; Wed, 23 Aug 2017 08:30:03 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3DD67267140; Wed, 23 Aug 2017 10:30:02 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 86126267141; Wed, 23 Aug 2017 10:30:01 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.15.14]) by alsa0.perex.cz (Postfix) with ESMTP id B6A2A2665D5 for ; Wed, 23 Aug 2017 10:29:59 +0200 (CEST) Received: from [192.168.1.2] ([77.182.78.200]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MYNof-1e6AwF0nFB-00V4qF; Wed, 23 Aug 2017 10:29:54 +0200 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Arnd Bergmann , Arvind Yadav , Dan Carpenter , Ingo Molnar , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto , Vegard Nossum References: <800d7aa6-d8f2-cbf5-caaa-7e4006976e68@users.sourceforge.net> Message-ID: <6ce55a29-f414-fec4-0a5e-2ddd54e40bed@users.sourceforge.net> Date: Wed, 23 Aug 2017 10:29:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <800d7aa6-d8f2-cbf5-caaa-7e4006976e68@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:c0EX4AslYd6v32JVf/pzLBWdmzNBwYjUZdkhWZ1nKFtLg9XI1RD JQRipgA8mm65yzXdmBVy30UKyHDSMmdsjJPAcgQcemkhsomhyqnBEijq4K71N3MAVnl+RFp PkJ8tL2MwaLap8h4A4nSO7NZu+tn2R/Lx9mcIxMkKdeYbsyZGK1qms6yV6pHGptZhFfsZ5Z NtebiBtUKKHVOHkDdQoDg== X-UI-Out-Filterresults: notjunk:1; V01:K0:jDOXP+W0BQc=:4zKNyY9Igfa8leXQdW47Xs giujGCNTSS21WiovJadlkdugz77vtNlArJ1eGjZL3RjekfhGLFLq+qTOJi7PCwWRgQLVRcCOl /QIA2O06AVwVDMS7ApmIZ34CC9LimnYkev8Bxb59TEYXJIypIst/9zCWQj7bYTPUVmuBdwaDL TXqmgpejmKKbyIXzDanvbRXK1Ud2aUH6S5yzscfFCflQ6x4VlojhI++wcSQIhlb3LPBZHZ2Ni M1e2C1hetGdZqHkRm33TClpNK1mKzV1+23ytnv259oKQFJ3J0ChJFkxrWL37KfIhpYgFOykHG fkW7Absu5Kol1Sj2b4dzC6rinnlFPTf/EhS20S+3oNjrX+N1l9Z5GBZGdjloDJfhk0dzGafcc XeIMn6ASC3O/FXvdXy6jxw6Bsg72DCAzq41c22IwUW1oesnPrSAV3BldflOSgSqH0l5PUdJgz 5EEUUAvj8vRbwqlQ3DFQYt5BLE7KDJusLRWCykHR4R0edNuSE0irkrkgJo0Ds3J4T+0O4gCqb i/PMb6YYKB8ml8mbaOqLEuPWrkfiR1EcWiZnXourcn0R84Tv1b3NJRddEQuWwmDOdIJ3PDiAE LvUzlo6YoLD7rFX4Bac02yI2e9rcv4PTsfEj7dxFVAmZstI2o/gLCdhN12MI8n4VIuxUzXg7y hV69v6NBlsU6lRhegB+dBcY/wXuVyD1ks6PQdeDkk6/GITJK4CeoUFClj/nIgjtMG9I5715h0 odopzF8aBYCNoDuB4sG9+yf9mN2hYN1OWwiLMqwU+nj5+rGPVjdkRSNIFxMxLP33afg8DYr7I enXBPHRYCYrOEi7H5/GcKFoNqW+ykN6VdbCXBlMzV23WrdBoYo= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 23 Aug 2017 09:54: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 the affected source code places. Signed-off-by: Markus Elfring --- sound/core/timer.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sound/core/timer.c b/sound/core/timer.c index 6cdd04a45962..ff94842f7b01 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -106,7 +106,7 @@ static struct snd_timer_instance *snd_timer_instance_new(char *owner, { struct snd_timer_instance *timeri; timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); - if (timeri == NULL) + if (!timeri) return NULL; timeri->owner = kstrdup(owner, GFP_KERNEL); if (! timeri->owner) { @@ -141,7 +141,7 @@ static struct snd_timer *snd_timer_find(struct snd_timer_id *tid) continue; if ((timer->tmr_class == SNDRV_TIMER_CLASS_CARD || timer->tmr_class == SNDRV_TIMER_CLASS_PCM) && - (timer->card == NULL || + (!timer->card || timer->card->number != tid->card)) continue; if (timer->tmr_device != tid->device) @@ -391,5 +391,5 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri) { struct snd_timer * timer; - if (timeri == NULL) + if (!timeri) return 0; @@ -425,7 +425,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) return; timer = ti->timer; - if (timer == NULL) + if (!timer) return; if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) return; @@ -586,7 +586,7 @@ static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop) */ int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) { - if (timeri == NULL || ticks < 1) + if (!timeri || ticks < 1) return -EINVAL; if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) return snd_timer_start_slave(timeri, true); @@ -722,7 +722,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) unsigned long flags; int use_tasklet = 0; - if (timer == NULL) + if (!timer) return; if (timer->card && timer->card->shutdown) @@ -856,7 +856,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, spin_lock_init(&timer->lock); tasklet_init(&timer->task_queue, snd_timer_tasklet, (unsigned long)timer); - if (card != NULL) { + if (card) { timer->module = card->module; err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops); if (err < 0) { @@ -909,7 +909,7 @@ static int snd_timer_dev_register(struct snd_device *dev) if (snd_BUG_ON(!timer || !timer->hw.start || !timer->hw.stop)) return -ENXIO; if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) && - !timer->hw.resolution && timer->hw.c_resolution == NULL) + !timer->hw.resolution && !timer->hw.c_resolution) return -EINVAL; mutex_lock(®ister_mutex); @@ -1114,7 +1114,7 @@ static int snd_timer_register_system(void) strcpy(timer->name, "system timer"); timer->hw = snd_timer_system; priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (priv == NULL) { + if (!priv) { snd_timer_free(timer); return -ENOMEM; } @@ -1182,7 +1182,7 @@ static void __init snd_timer_proc_init(void) struct snd_info_entry *entry; entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL); - if (entry != NULL) { + if (entry) { entry->c.text.read = snd_timer_proc_read; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); @@ -1378,7 +1378,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file) return err; tu = kzalloc(sizeof(*tu), GFP_KERNEL); - if (tu == NULL) + if (!tu) return -ENOMEM; spin_lock_init(&tu->qlock); init_waitqueue_head(&tu->qchange_sleep); @@ -1537,7 +1537,7 @@ static int snd_timer_user_ginfo(struct file *file, ginfo->tid = tid; mutex_lock(®ister_mutex); t = snd_timer_find(&tid); - if (t != NULL) { + if (t) { ginfo->card = t->card ? t->card->number : -1; if (t->hw.flags & SNDRV_TIMER_HW_SLAVE) ginfo->flags |= SNDRV_TIMER_FLG_SLAVE; @@ -1611,7 +1611,7 @@ static int snd_timer_user_gstatus(struct file *file, gstatus.tid = tid; mutex_lock(®ister_mutex); t = snd_timer_find(&tid); - if (t != NULL) { + if (t) { if (t->hw.c_resolution) gstatus.resolution = t->hw.c_resolution(t); else