Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752031AbdHaXja (ORCPT ); Thu, 31 Aug 2017 19:39:30 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:35438 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751979AbdHaXj0 (ORCPT ); Thu, 31 Aug 2017 19:39:26 -0400 X-Google-Smtp-Source: ADKCNb5fdhCdxQ8vg9D1LtUIZ92Fsy/xj3SKfeOuyIh3tR7oP9ep74w6ZWoTaruzByJkHXca3XECTw== From: Kees Cook To: Thomas Gleixner Cc: Kees Cook , Ian Abbott , H Hartley Sweeten , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 26/31] staging/comedi/das16: Make timer initialization unconditional Date: Thu, 31 Aug 2017 16:29:38 -0700 Message-Id: <1504222183-61202-27-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504222183-61202-1-git-send-email-keescook@chromium.org> References: <1504222183-61202-1-git-send-email-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1504 Lines: 42 With timer initialization made unconditional, there is no reason to make del_timer_sync() calls conditionally, there by removing the test of the .data field. Cc: Ian Abbott Cc: H Hartley Sweeten Cc: Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/comedi/drivers/das16.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 5d157951f63f..4514179b2007 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -941,10 +941,8 @@ static void das16_alloc_dma(struct comedi_device *dev, unsigned int dma_chan) /* DMA uses two buffers */ devpriv->dma = comedi_isadma_alloc(dev, 2, dma_chan, dma_chan, DAS16_DMA_SIZE, COMEDI_ISADMA_READ); - if (devpriv->dma) { - setup_timer(&devpriv->timer, das16_timer_interrupt, - (unsigned long)dev); - } + setup_timer(&devpriv->timer, das16_timer_interrupt, + (unsigned long)dev); } static void das16_free_dma(struct comedi_device *dev) @@ -952,8 +950,7 @@ static void das16_free_dma(struct comedi_device *dev) struct das16_private_struct *devpriv = dev->private; if (devpriv) { - if (devpriv->timer.data) - del_timer_sync(&devpriv->timer); + del_timer_sync(&devpriv->timer); comedi_isadma_free(devpriv->dma); } } -- 2.7.4