From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753671AbcHWSvF (ORCPT ); Tue, 23 Aug 2016 14:51:05 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33578 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751233AbcHWSua (ORCPT ); Tue, 23 Aug 2016 14:50:30 -0400 From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Sudip Mukherjee Subject: [PATCH 1/2] staging: ks7010: return on failure Date: Wed, 24 Aug 2016 00:07:35 +0530 Message-Id: <1471977456-7784-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On failure we were jumping to error_out0 where we were trying sdio_release_host() but at this point of execution we still have not done sdio_claim_host() and as a result host->claimed can still be 0. And if host->claimed is 0 then WARN_ON(!host->claimed) will give a warning. Moreover, if it is still not claimed then mmc_host->claim_cnt will be 0 and mmc_release_host() will do "if (--host->claim_cnt)" and thus the condition will become true. Lets just return the value on allocation failure instead of trying to release the host before claiming it. Signed-off-by: Sudip Mukherjee --- drivers/staging/ks7010/ks7010_sdio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 47b69cb..7bcf1ea 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -776,10 +776,8 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv, /* buffer allocate */ rom_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL); - if (!rom_buf) { - rc = 3; - goto error_out0; - } + if (!rom_buf) + return 3; sdio_claim_host(card->func); -- 1.9.1