Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1814864imm; Sun, 12 Aug 2018 00:00:34 -0700 (PDT) X-Google-Smtp-Source: AA+uWPybc7R7SkqHGi91XP13Q1HxHm02hbiB+q+BtDkWrPmXK9X6Ps36Lzu5LX8LfUK+DTwVdnxX X-Received: by 2002:a17:902:6946:: with SMTP id k6-v6mr12215829plt.268.1534057234798; Sun, 12 Aug 2018 00:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534057234; cv=none; d=google.com; s=arc-20160816; b=XV+gjcPoeZJV+EYRpiZ2wYdZPi6Bwu67IDnvYEFhyiBhXnI5aCDMNz5y2v8YFxpfu6 T2KpBxv5nAHybEjniCxGFidZn+wFm6oz0qiOscT4FHcR2+4kz4IveFhk1DSUP2/18JIP qV9gx/Y7UlKZbiMH+0OdIMC+n3qoGPTin2icD01jYHqp1nW+zNWihx0P5AE5XB3d6YMn pEAthJgz+T8T9++KpCBQCIGZyrGL4aGEsW60RBymjjCb6rUdR89nypDr9XtbC0wEqT4X sOf2TMWkkPidlWDMyLmUznvx7byksxOVGoxWRSHfjYMT0f6tK1J/hSDIo8jdT1NRD4Q4 Qxeg== 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:from:date:dkim-signature :arc-authentication-results; bh=KKxaNydyGpmRa//Lja/l6lRO0TveX+lDLJnNrPc+i+Q=; b=R2SQaqBnSIo6X2UVeOJUptef5EJi59GxNG4JS3zjqdzaw2xcszoyRkAgv+KerhsCFR O7X0yFUJJVpfQkP92l7Hw7e5MYvXNEiytmy2GNJTEosaF0Hs2GGHAbUd84Shc7sFbDeE httj7BHK9+qlnQhh0Wn9o2KkOEYYVKv+NGzk2iNDuL4P0ZKzbz3FIeWvHzdSPoSsGz4O q0+yqPIu3Ho3vhpWD4K6bfQ3FSQCFwGo0ganAgh8+uYtV7iw2MbKd9q4CxU7KlDos8+j mtTz0B/N+YZeSknIFNGhWJYcYTMYziDYYp7AuqiUY+GdTSiYIuGDE6YXuNROEG1bkelf YV3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k7xTpEx2; 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 w65-v6si14185989pgb.377.2018.08.12.00.00.05; Sun, 12 Aug 2018 00:00:34 -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=k7xTpEx2; 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 S1727549AbeHLJfl (ORCPT + 99 others); Sun, 12 Aug 2018 05:35:41 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39138 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726950AbeHLJfl (ORCPT ); Sun, 12 Aug 2018 05:35:41 -0400 Received: by mail-pg1-f195.google.com with SMTP id a11-v6so6158875pgw.6 for ; Sat, 11 Aug 2018 23:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=KKxaNydyGpmRa//Lja/l6lRO0TveX+lDLJnNrPc+i+Q=; b=k7xTpEx27vyemi292P7zg9KiuDecJAZmE18VEKFlB7UksIesF0lToBG1aJinP6z++j +BzNAClE83b2C5amD8rIQm8+WdyKCbjwRYHuu868AePGN0EiaiFodbA4eaMyVQcqvGQS syIJGoxbdsNlZxzpRh0vMmH4Cjf3zbQhD4NczLpVeh51uaSsKuofniz3DXjNDj2DrrwZ 0eVjpk/30Nr2m21LEUSZQEObD+RPCotU5PeH1xM/H1HRnbUgTtyr9+mLsK7IgJylrmle zZhcJytFiBVTdWEmaurmBe/pSxoZJ0MwO7/26tEYILNoNDtWoWCIM9i1arvu10PQx04H MS3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=KKxaNydyGpmRa//Lja/l6lRO0TveX+lDLJnNrPc+i+Q=; b=Agm5Fop1jDL18OQJFJcQAjTxBV7zsUG9CfcnKywEJTHakPtIPkf55aJwC/NMS/65Rv U+33w3W1qLbCLUbvWVm0Xfz4nlhX87IBVxu8fy7PY5BZ8H/xtcJkjX63BznhNa/Zvq3E UeHzMtZuoNuWXshOLEs+ofezrYl5E6UU5Yl1fxRmlTSYz6lRXDXG0SWikIajuhxzISvs NRyhRNONYp+lSE0/pkFhp0HeC/23p6qem5BUrzCdP12G2/vc+WtYbrDehxy+yrbP77bk CFD+6TO6j+Hgsg7uQBsyVHdGteuJZdFdV6/GzNrS5ovc4CQitjxp07Gu+IksY5XVsJ3G L/aA== X-Gm-Message-State: AOUpUlGTj+dgSrzuc/Xw0hVxHXIaKTLpI1ZmNAuHjf2hoEtAVXAPBmzr S07qXvZQivygdtPWloW3sVxSmw9Dd3M= X-Received: by 2002:a63:f244:: with SMTP id d4-v6mr12215935pgk.2.1534057121388; Sat, 11 Aug 2018 23:58:41 -0700 (PDT) Received: from ubuntu ([119.82.107.14]) by smtp.gmail.com with ESMTPSA id 22-v6sm24381818pfl.126.2018.08.11.23.58.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Aug 2018 23:58:40 -0700 (PDT) Date: Sun, 12 Aug 2018 12:28:37 +0530 From: Sumit Kumar To: Rob Springer , John Joseph , Ben Chan , Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: gasket: remove null ptr check before kfree Message-ID: <20180812065837.GA20728@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