Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1485371imm; Sat, 11 Aug 2018 14:49:50 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz9f47UxCKb1cT6PHGooEScmwFpPufeeIKMlA5wmN0YnWfX4q5O+wv+eLK95yITbqR/VvfS X-Received: by 2002:a63:4a07:: with SMTP id x7-v6mr11596173pga.34.1534024190227; Sat, 11 Aug 2018 14:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534024190; cv=none; d=google.com; s=arc-20160816; b=Jygjl1UEiRAM3WbTZsfkdUSlIvY6gie3naX9nIAsEWFCoS+3DMFBF3xJCQGjuwK3Cm 8laRiWbWmiU/baAlmjIFOfKst/O9EJ79v4NixGiXXuTcEyjsWC8QaY56YR/caA/Szwmx M2vqWEDlzkkX2a8Jp7GbuP3fLi3wPPKHfi2qlXYJc07c8ubYBKLdzElH8PUzDYHnkQJx jEISpF8Blqbw+NlVkc+0qSlLtmxf8nuTr6jKN8J3v2bbK1o/WfBwKwtpR0ExeffdYnsQ 0Tjz50PKkARV66trDGkXrCh/vFEPW/FnOzF6+IwooDSGgW/4X2D2iDwcJHFoj62stzGx 6ubw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:date:from:dkim-signature :arc-authentication-results; bh=KKxaNydyGpmRa//Lja/l6lRO0TveX+lDLJnNrPc+i+Q=; b=Jj3wVGa3UOSjbuNJ7ffhTmS/HF7AnKZeyb2NP0tjsJIyfx7V9PBmSNy7TEr9NxVCPT MIXUghSRrV5jO71Uzv+168jfqQJZj93FjCCMigXj54ex0hzUJ2CPvFUksy6HBAwey4o7 3TvhOm9Qq14M3iBxThwGlAuSsoSbo+couj7XtpTz/NlKTuA6auZBiU9A9aV7K2D4Z3Iw OIVs9XdGdkDbjYa9ahHq4p0X/iVGVZXE+1CuGAxJ/8ugmgPkJstBXOenQuFNgeIe5D8I juQ0sx4BlDh6CIsRGf15NfHlfrPdc3pwifsfsf6MWLdil7TtI6RkAf6727yFfLaVZe/V +3mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jYySlrD6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26-v6si13707151pgl.49.2018.08.11.14.49.22; Sat, 11 Aug 2018 14:49:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jYySlrD6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727492AbeHLAXb (ORCPT + 99 others); Sat, 11 Aug 2018 20:23:31 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41382 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbeHLAXb (ORCPT ); Sat, 11 Aug 2018 20:23:31 -0400 Received: by mail-pg1-f194.google.com with SMTP id z8-v6so5882896pgu.8 for ; Sat, 11 Aug 2018 14:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=KKxaNydyGpmRa//Lja/l6lRO0TveX+lDLJnNrPc+i+Q=; b=jYySlrD6HjoIDSDnZZ0oblP+l74XmqBPySzvOnH2+FTWOWTfHwdOFjnTO2sok/2LLZ NikPNje/vcNCHaHTSq0GIqfbqxrK1Qxo6+wn+1ASmGqW0uMn3H2eB+yP+RGZvMgUS81e XlaC5Bsge0iOpAyphX2Q6JSfu3thaBeQt3gXQpW8fFwQJYVYRACgAUROST56jZ8X+MW+ ARlx9WgdNFXJCeudJfIIMQ4qKXYwbXz1DXv+PIXQpjF3/RPX2JvwG9r6S1a0zbEpxWMr 4e9HWQRYV8djdY8oE/hcCyNf6cJGrgRULtYBEyRDFKHGzsC3saQlJk3NLvY2zJmP6K3R l6Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=KKxaNydyGpmRa//Lja/l6lRO0TveX+lDLJnNrPc+i+Q=; b=sCd2YTDz+i9F7Dq4JtmUU6eJauaujkhfyKayCSOVNuqjZkSy7H/ZzgF35zEZONP5G3 ecfF7IGOc74MjGKjGpsZKWwj6JXE9K3+qz3IDSFN6OeU1Z9v34EYe9iOdKmMkXg05HXs 52ldqpbO/pfyr6zmYbimdNIvokNSl61yCDUevHzv0jvVU4/fKclbNoIWElFSVg1W2FNm lu3Wex/4l4jnAqSF99JWNFH5OqwvWoQPIosbNIEgdMv2N0uIaZnyelJOwhVVStNwzjay Dw+LZYmINWXt/Z0t+HTfvXDa+PgvijoimR93LssQYPSLo3/gowkVhw22NJALRQkbv+oA FhKg== X-Gm-Message-State: AOUpUlH5wnigahDkuwdzWDh2409RCQTuwIMEFdx7xS6v9K7vbGJ5Gwk5 RMJiTbc+i1pnEzClKvsqHogYYBAqWZw= X-Received: by 2002:a65:5c83:: with SMTP id a3-v6mr11480397pgt.164.1534024078551; Sat, 11 Aug 2018 14:47:58 -0700 (PDT) Received: from ubuntu ([119.82.107.14]) by smtp.gmail.com with ESMTPSA id h130-v6sm52608986pgc.88.2018.08.11.14.47.57 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Aug 2018 14:47:58 -0700 (PDT) From: Sumit Kumar X-Google-Original-From: Sumit Kumar Date: Sun, 12 Aug 2018 03:17:53 +0530 To: Rob Springer , John Joseph , Ben Chan , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org Subject: [PATCH] staging: gasket: remove null ptr check before kfree Message-ID: <20180811214753.GA14868@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove null ptr check before kfree because kfree is null ptr safe. Issue found by checkpatch. Signed-off-by: Sumit Kumar --- drivers/staging/gasket/gasket_page_table.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c index d4c5f8a..bd921dc 100644 --- a/drivers/staging/gasket/gasket_page_table.c +++ b/drivers/staging/gasket/gasket_page_table.c @@ -1328,10 +1328,8 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size, num_pages * PAGE_SIZE, mem, handle); } - if (gasket_dev->page_table[index]->coherent_pages) { - kfree(gasket_dev->page_table[index]->coherent_pages); - gasket_dev->page_table[index]->coherent_pages = NULL; - } + kfree(gasket_dev->page_table[index]->coherent_pages); + gasket_dev->page_table[index]->coherent_pages = NULL; gasket_dev->page_table[index]->num_coherent_pages = 0; return -ENOMEM; } -- 2.7.4