From patchwork Sun Jul 30 06:31:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel test robot X-Patchwork-Id: 9870215 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 060F26038F for ; Sun, 30 Jul 2017 06:32:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0B60285FD for ; Sun, 30 Jul 2017 06:32:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D37FA2860D; Sun, 30 Jul 2017 06:32:06 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53F39285FD for ; Sun, 30 Jul 2017 06:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751305AbdG3GcE (ORCPT ); Sun, 30 Jul 2017 02:32:04 -0400 Received: from mga02.intel.com ([134.134.136.20]:29764 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943AbdG3GcE (ORCPT ); Sun, 30 Jul 2017 02:32:04 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jul 2017 23:32:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,435,1496127600"; d="scan'208";a="131124107" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by orsmga005.jf.intel.com with ESMTP; 29 Jul 2017 23:32:02 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1dbhpz-000HEk-1g; Sun, 30 Jul 2017 14:36:27 +0800 Date: Sun, 30 Jul 2017 14:31:52 +0800 From: kbuild test robot To: Guennadi Liakhovetski Cc: kbuild-all@01.org, linux-media@vger.kernel.org, Laurent Pinchart , Hans Verkuil , Guennadi Liakhovetski Subject: [PATCH] uvcvideo: fix ifnullfree.cocci warnings Message-ID: <20170730063151.GA22846@lkp-nex05> References: <201707301426.vKSguE4n%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1501245205-15802-6-git-send-email-g.liakhovetski@gmx.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP drivers/media/usb/uvc/uvc_ctrl.c:1327:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. NULL check before some freeing functions is not needed. Based on checkpatch warning "kfree(NULL) is safe this check is probably not required" and kfreeaddr.cocci by Julia Lawall. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: c698cbbd35da ("uvcvideo: send a control event when a Control Change interrupt arrives") CC: Guennadi Liakhovetski Signed-off-by: Fengguang Wu --- uvc_ctrl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -1322,9 +1322,8 @@ void uvc_ctrl_status_event(struct uvc_de return; spin_lock(&w->lock); - if (w->data) /* A previous event work hasn't run yet, we lose 1 event */ - kfree(w->data); + kfree(w->data); w->data = kmalloc(len, GFP_ATOMIC); if (w->data) {