Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754459AbbFRMhI (ORCPT ); Thu, 18 Jun 2015 08:37:08 -0400 Received: from mail-am1on0103.outbound.protection.outlook.com ([157.56.112.103]:24016 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750892AbbFRMhE convert rfc822-to-8bit (ORCPT ); Thu, 18 Jun 2015 08:37:04 -0400 From: "Abdul, Hussain (H.)" To: "gregkh@linuxfoundation.org" CC: "johnny.kim@atmel.com" , "rachel.kim@atmel.com" , "dean.lee@atmel.com" , "chris.park@atmel.com" , "linux-wireless@vger.kernel.org" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , "mravind@visteon.com" , "Dighe, Niranjan (N.)" Subject: [PATCH] Staging: wilc1000: NULL check before some freeing functions is not needed Thread-Topic: [PATCH] Staging: wilc1000: NULL check before some freeing functions is not needed Thread-Index: AQHQqcN45tOcDKdtjUa4dMUtsEcWlQ== Date: Thu, 18 Jun 2015 12:37:00 +0000 Message-ID: <1434630935-4526-1-git-send-email-habdul@visteon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 1.9.1 authentication-results: linuxfoundation.org; dkim=none (message not signed) header.d=none; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [74.112.167.117] x-microsoft-exchange-diagnostics: 1;DBXPR06MB611;3:SGzfNfU7qWyLN+YbystcEYO0JJo3UI0Iz8I+oHepcFDGp2/Z8PxoSPJSaX4WTjYCPUXfWoTUfcup8KlkjQc9NYQ1QtV74uqojjtBmwiW4ACNQNC4jb8J2Z2mlV2gPSKpigkEdaNM6rHV0PryhK1rSA==;10:losElr7Zswe8BnZca36OcU4JgPf856fIk3CmmCmSw3whDC1clPLgylclu+k0DNOCcX/mjEfMgitZpOt2xxwynH4LHil3sPg0BIa74cIhW5k=;6:ZvJ1TwL2OWuEq9ccZSWTPhbFrwBdVQ8M9Ro438tbEGP23FEMvV169PgtB1uo2oCd x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DBXPR06MB611; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:DBXPR06MB611;BCL:0;PCL:0;RULEID:;SRVR:DBXPR06MB611; x-forefront-prvs: 0611A21987 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(106116001)(77096005)(50226001)(86362001)(46102003)(2900100001)(102836002)(50986999)(2656002)(87936001)(36756003)(110136002)(19580395003)(19580405001)(66066001)(33646002)(2501003)(5001920100001)(92566002)(107886002)(5001960100002)(5002640100001)(189998001)(122556002)(40100003)(62966003)(77156002)(229853001)(2351001)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:DBXPR06MB611;H:DB5PR06MB1112.eurprd06.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT MIME-Version: 1.0 X-OriginatorOrg: visteon.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jun 2015 12:37:00.2262 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7a147aaf-01ec-498c-80a1-e34a8c63c548 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBXPR06MB611 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1357 Lines: 41 From: Abdul Hussain This patch removes check before freeing the memory since kfree(NULL) is safe Signed-off-by: Abdul Hussain --- drivers/staging/wilc1000/linux_wlan_spi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 1eee1d5..236669c 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -214,8 +214,7 @@ int linux_spi_write(uint8_t *b, uint32_t len) PRINT_ER("SPI transaction failed\n"); } } - if (r_buffer) - kfree(r_buffer); + kfree(r_buffer); } else { PRINT_ER("can't write data with the following length: %d\n", len); PRINT_ER("FAILED due to NULL buffer or ZERO length check the following length: %d\n", len); @@ -377,8 +376,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen) } } - if (t_buffer) - kfree(t_buffer); + kfree(t_buffer); } else { PRINT_ER("can't read data with the following length: %ld\n", rlen); ret = -1; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/