Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2927802pxb; Tue, 12 Jan 2021 01:57:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcUj2T9uf7J/3cnSszNtsNwyxM6eJStL4T/UKfqTyCAAshlC5c7jXFvMmsAC7Op7Uxz9DB X-Received: by 2002:aa7:c60c:: with SMTP id h12mr2739356edq.145.1610445474143; Tue, 12 Jan 2021 01:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610445474; cv=none; d=google.com; s=arc-20160816; b=cqWYeRQ9875vHx0YZC08FVO1Cm0w4AWkMxhgzGO4EvhaYoAZi8h3jToDhXexV1P2xi tJbCwc5XV9679ZidKPB2w0XAM9wUEUcbTaMDfWdlgBfXhmE8g6QSuT85SiyxWg2kKK89 O7zLlFnQuSjAvC0Caa6CcEqjm0ojQY1s6nUF6wTmZbXDiffw+imuCjjIoCTupH9BItLv KJQQ4gwReAnk1WnF2UMekaD7P1LoToQdIohrof6gnzCBCoLRiRApwfcTrUa/UPaVeKy9 NW/uMMOPwy7ez4EHIWgtXYIassLJD88oOAqleuTILbMLrR92T/dyrwwZWoe0uJVpZALK 1ScA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xyU1qXhFS+Q5kEBh6OIYD0/hY8J4qIIa9KE0oW+Vc1M=; b=KuXHBzRHY40Y2r60CjRJ//UKTqi6ikxRY/QDGGPCl3SptrEWGpoOUng1PyZ0Qe9dWw OFg32Rn8XxLjlqUUAxSPCXHSbN7v04/Buu7Px5v5HHExdqMs3rV0Ba/0lOGdlAaDqAfS rss0sEz9kk9eFPqZY9Gu87evObibppbqV996UcpHEIS1148WSQDNE2gPteYwJmLfqWCR skmpUOYB6ibCjSdV8nQoCV+RYLcQ99pQBmXdSC8IJlfaUm/NRjPilt8YsIdgfzLN7VGY dlm9SOspJw1HoiPQZN5ufkPH+uiTvq2wJ/qZvxwyiXYG1NGwMd2N26OD4YJ6GopsKNCZ TcOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lXVSvkmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si938225ejw.724.2021.01.12.01.57.30; Tue, 12 Jan 2021 01:57:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lXVSvkmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729762AbhALAYi (ORCPT + 99 others); Mon, 11 Jan 2021 19:24:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:58608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390752AbhAKWpq (ORCPT ); Mon, 11 Jan 2021 17:45:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D5E6222CAF; Mon, 11 Jan 2021 22:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610405105; bh=chIuNkxQOqz1a6QXqkz+qMeyAZzOJBFgOOVyoy2AHg4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lXVSvkmweExnqRTKLa4hpHUhuJffG6JpHvCiOnlK86JHt7ENw9EteCKmdUipxAR0J v9yc3z0R6Tb0vKtcvrbJCcEFhAiaWp6us0g7wJo06bmKcI4j3FKVmFlEHWwHF+0iqh OhM/aLkcLfIApH8H3zQbBNjLpbsF8pkMz2XLda9nJ4rGteA6tzhxHnJwWnn55ZPYRU WHIvLyQAS5mVXZx+jKx/Zo143FY44JUZG0ajrJN0RFhwRWSxQJy6KnfK2hXyYf81W/ TXJ7pNJoRCmyXXhQUzQqWNsvk8ag1wfFpq83ZDE1KU5w5IC7iXRV8Ru7HD99vKSqNE 5fb44Pgt8gEPQ== Date: Mon, 11 Jan 2021 14:45:02 -0800 From: Eric Biggers To: Bean Huo Cc: alim.akhtar@samsung.com, avri.altman@wdc.com, john.garry@huawei.com, jejb@linux.ibm.com, martin.petersen@oracle.com, satyat@google.com, shipujin.t@gmail.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Bean Huo Subject: Re: [PATCH 2/2] scsi: ufs: Remove unnecessary devm_kfree Message-ID: References: <20210111223202.26369-1-huobean@gmail.com> <20210111223202.26369-3-huobean@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210111223202.26369-3-huobean@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 11:32:02PM +0100, Bean Huo wrote: > From: Bean Huo > > The memory allocated with devm_kzalloc() is freed automatically > no need to explicitly call devm_kfree. > > Signed-off-by: Bean Huo > --- > drivers/scsi/ufs/ufshcd-crypto.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c > index 07310b12a5dc..ec80ec83cf85 100644 > --- a/drivers/scsi/ufs/ufshcd-crypto.c > +++ b/drivers/scsi/ufs/ufshcd-crypto.c > @@ -182,7 +182,7 @@ int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba) > err = blk_ksm_init(&hba->ksm, > hba->crypto_capabilities.config_count + 1); > if (err) > - goto out_free_caps; > + goto out; > > hba->ksm.ksm_ll_ops = ufshcd_ksm_ops; > /* UFS only supports 8 bytes for any DUN */ > @@ -208,8 +208,6 @@ int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba) > > return 0; > > -out_free_caps: > - devm_kfree(hba->dev, hba->crypto_cap_array); > out: > /* Indicate that init failed by clearing UFSHCD_CAP_CRYPTO */ > hba->caps &= ~UFSHCD_CAP_CRYPTO; Looks fine, feel free to add: Reviewed-by: Eric Biggers I think this was here to free the memory in the case where the crypto support gets disabled but the UFS host initialization still continues, so that the space wouldn't be wasted. But that's not what happens, as this is only reached on ENOMEM which is a fatal error. - Eric