From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756AbdHWIay (ORCPT ); Wed, 23 Aug 2017 04:30:54 -0400 Received: from mout.web.de ([212.227.15.14]:65192 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753631AbdHWIaw (ORCPT ); Wed, 23 Aug 2017 04:30:52 -0400 Subject: [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers 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 Cc: kernel-janitors@vger.kernel.org, LKML 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit 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= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.14.0