Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1821921imm; Sun, 12 Aug 2018 00:10:48 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxRlmKwDM4UobTZIDjD5hw0wSYb2XvNQWcY/xJMtdsok4ayCkCRvLcS9zTYS/ojS12tGID/ X-Received: by 2002:a17:902:28a4:: with SMTP id f33-v6mr12097336plb.297.1534057848428; Sun, 12 Aug 2018 00:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534057848; cv=none; d=google.com; s=arc-20160816; b=ZYENv9VvdKSE1ujg2nhFLxYMC8QtGqOphjeZ/HKQsqfC0rwTuJ+PW1h5dxsAm6cicR lbFLGNzHsbtpXsMcWpsjC1DVBzReWUBJuxU3O/hnsZOlNM8Ow1n7E4xiXLa6S545Gcn1 nBxGtSL4/w3KDym6tKgnHAJg8w6NljaRBnp/GTsZH66ScWpSer1pfaZXVe4990N5te3e li7DWta4Fe9XmB+54jAGpQvJdkyX57MgD4nXJx4U7vHfVBQx52n90JYyZ7pHvGe+cLt4 HsU89rDvEHqme+zc/vDwGvOX9UOZZaoDgd3+QJIma9DDEHWJYJPx03kwuskZksV3NpMl ze+A== 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=YBrcLRvJMlTXpJcW2Cg4qIRV5WwSfL/dJR2jgM0zSB0=; b=RZn4s7FXpLbdIVUJZNF04YH+Aj4BrfhvtJv5WlmUqt9IhpwclH066Bqs69b3TD0OLk jw4LO+tSDeS/zM75ZL3cSWju+8RXV6aTawmy0yCoFCt27MzixnoBRXB92wzy2NP2udlv U/TWdrs6RY5hsEziKl9ym1EmJ1kuw2Lp6L1ACGz4mVEb7Yq1TaR30NJpwxTvawGJzW51 ohXrHJDoIwMHDjAvPS1qcLsRDOwH/2qPF0F3bPnnEZwVgKSbNhVWYCLkb9eAMRdtu3u3 xQNTGUI8jnmuJwFcBb453pNwnVMMZ7Bn6jhrje1a1y9/s3voefdp3NGg+byEJFJjsQ/f yWqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IexXBd9j; 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 t14-v6si13784374pgi.449.2018.08.12.00.10.33; Sun, 12 Aug 2018 00:10:48 -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=IexXBd9j; 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 S1727769AbeHLJpZ (ORCPT + 99 others); Sun, 12 Aug 2018 05:45:25 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35689 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726878AbeHLJpZ (ORCPT ); Sun, 12 Aug 2018 05:45:25 -0400 Received: by mail-pg1-f194.google.com with SMTP id w10-v6so6177805pgv.2 for ; Sun, 12 Aug 2018 00:08:23 -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=YBrcLRvJMlTXpJcW2Cg4qIRV5WwSfL/dJR2jgM0zSB0=; b=IexXBd9jaodGHjdXUblJpGBAKzGLiC+djOr3xq9bRr4EZ6SvaNgGTo1/n+HEjxKUrf xd20n/RcA+yleRcq5SpOdC4HkhYMXn7yg3dxR9HVKOfnetIWZY+uHVr7oiGNTfJ09csT 4QxRcxZjO861hFn6U0TI7ewVXGIYhieoQs3goqK4jS5ly/xN2ehL7g15/we5ADV5+ENi 93q/7kUBr8PO9Ub5VPHLCVh7Uu2v2SMcQogozL61nqNMEgoOLoUTFK/SF2CqoKGp4ylX nC4m7szAIIGdX1m5gLoZxeyEk8BIdI0rXJbCI17rQM+iqSx/zOq2iQs30PLrXoTurToh WP8A== 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=YBrcLRvJMlTXpJcW2Cg4qIRV5WwSfL/dJR2jgM0zSB0=; b=bclGmez4GfN0tqj/7/ZV+4mHOAzAu/B4WYRIO8mPxvWyZRDWisNKkaHzMgdNrStaV5 lmy0yOk2zy2DCvWZ/wof6bIRDUSLDTphHecmH4xbBHaAkByGWJ7kWYGlXM5Hxk6G81RJ T33zdoFziHZ0jp4ztg0nXNs9rsJGyxTiZUnLUck8rZdwsVreNkuvp12JqRbtixwj0Dsp 1KpJ703bbC+nl39IOd1y3sCDkLJ9uZ8SVNPD2oe9RUNz0CFDRw6my8CU7ermjjh1c1kh z+KVb4AcjyMoK0Zhr760Ep61L75Qqm+zQVFMJMxpz8thYrgHYNxQ4L0WYV6aRuWe0xAx PG8w== X-Gm-Message-State: AOUpUlE40jxeooJeWyG9SsXu+ShEogs2CBokFRV9r8KL1fgbCxS5oOac oktS1TweyvQF2ZW3ZzozttmC9F1RW2k= X-Received: by 2002:a65:658d:: with SMTP id u13-v6mr12684165pgv.20.1534057703161; Sun, 12 Aug 2018 00:08:23 -0700 (PDT) Received: from ubuntu ([119.82.107.14]) by smtp.gmail.com with ESMTPSA id u11-v6sm24065132pfd.117.2018.08.12.00.08.21 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Aug 2018 00:08:22 -0700 (PDT) Date: Sun, 12 Aug 2018 12:38:19 +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: <20180812070819.GA20860@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