Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1889578pxb; Fri, 5 Mar 2021 02:05:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7eNIejfzTPD/L8RrzLvJBRcbofScFZFKubrCkkOv+id4PnbxFFp8mJOYVDOpsKq3M+H18 X-Received: by 2002:a17:906:13c4:: with SMTP id g4mr1623316ejc.390.1614938745167; Fri, 05 Mar 2021 02:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614938745; cv=none; d=google.com; s=arc-20160816; b=f0C8gYYOh1LzoxbfJaft4NC3km4O+i2G5blY2bjD3dDn1XhNjvAJnh4R79F90BJiov 26pjBe5aWP2Z+HvFv8RrIlVkFoGjqsGlQlfPc64v3U0my26vaFPrNYbbSzXzpDki/Hbj I6s0/glo2q4qlGxEaeEmP+ZGLY+8uAW38rxiakZWLo89cBgvZXOhMRW+q4SDPhQZTK0A mDmrYRzitPKG5CSJyyQCWskfm6T//hd+UHW1n8I4G51ub1mq/1tD2QsvReoant5LRwT5 fQe9vLCq54IMLaHkv5MQ1NXVCwyBHopVUvbWpmHfckrqcMbmUxPOVG5y1kaJFPFDna6h esIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=hVEmTxN1/mqLbJZhppTs1tBr9kKu33Faj7BxFWSzlek=; b=xTU1QFpG8VRoQwFlqdzB9yxpjOZkJUYkU3D9ucQ9oJ72akX2nyqmtY/6KKstvsQKPa VOaAr+KpOZai2/lFC/GUlgZ7eepxHDJQ0zm1TqBSSt4ZgfFq6Bj9+hg+G2pTOagP/k4x CRMoVOLMiFse6AXsjrRNO6QwZqVg4y3yjZG5Nxov4+KsmJSbL5psVjFN4HY9mrGC91y+ +1s0Y1MnwZGuY6G9bnY2idiqqZgzOca2NLriEU/lx+8lr1Mec/zwxOsd2e3qQsSJ8Lrx DC8sn+ycByXHLkHdWsMgSwySWoog4Qm5Iz7aaVvrPWGaP0YQ30qVWZsrUP+dC0oGgZZz A72g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N+rGjt01; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c12si1279883edq.130.2021.03.05.02.05.22; Fri, 05 Mar 2021 02:05:45 -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=@gmail.com header.s=20161025 header.b=N+rGjt01; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbhCEKD6 (ORCPT + 99 others); Fri, 5 Mar 2021 05:03:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbhCEKDv (ORCPT ); Fri, 5 Mar 2021 05:03:51 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A7AC061574; Fri, 5 Mar 2021 02:03:51 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id w18so1690288pfu.9; Fri, 05 Mar 2021 02:03:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hVEmTxN1/mqLbJZhppTs1tBr9kKu33Faj7BxFWSzlek=; b=N+rGjt01Tn1WTdwZpzph0jO9N5UCT0sCWUKQWqRZy8aQq+5CNTKTLkR8VDduBwgDsL 6b1FBDK5gYpiyYRHWYVW0KVWT2tNF5sfTeYVcePwclq8nQ7HNVB6adEMkjt4443mE5Eu DK3jmf03Ph4vueHWPyo2BspEgINGALJdHE1Zqry6ZIjvfHK1f4D//BKjOwRnc4km3dBJ iuyRalT/pj1hvBz23OfTQ6/lYXn7gi+fhEN0EoZhD+VNxKPf2cqzC4QkddJd8X/DTudG hobXR+bD3XNEAzNPplqfJPfDfNFMutWuZjcAusf1BF+ZMAW111L5pEo4fzvPV5V6A3Tf vGZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hVEmTxN1/mqLbJZhppTs1tBr9kKu33Faj7BxFWSzlek=; b=uiMAWWx4938bURD96mDQsMvoy/5/6sS3J7opi+2LHhCSxnsOzDsjFoZYSmirwKEiKc 1gip9VkFzNptbBNHUOvMCQ0+C198qW7CRKSkoYogwxmgupLmb5DU8ac2fUbcSmpjpTso 94j6GpN+brie2e38f2LTqTPgFLn1Nz3fgDL/yD3E0WqF2YTEDZ33JrZoJNu2Z3/9Avcl qBPzoKp4pAyMaZfFUacmSUc6ZcSk1elwm3LgSO6QdWtP4REudSaeqXXfrAeGbrSShqvw KlcpAbem9rlaTbQZMlnNIhT3RcO2xMfmSs7uKRbqz6wACu/j2X2T489mjI039ehHxwsQ TL1Q== X-Gm-Message-State: AOAM533VJiFaHuSVKtV+9iDCzCVrLTcLC9jU/0IylzCo7L7p2IjM4D8b eiodndFay7XdvMmp5qoRl+A+nqJoR0O36j+J X-Received: by 2002:a63:ce15:: with SMTP id y21mr7886969pgf.4.1614938631331; Fri, 05 Mar 2021 02:03:51 -0800 (PST) Received: from localhost.localdomain ([45.135.186.129]) by smtp.gmail.com with ESMTPSA id e1sm1829137pjm.12.2021.03.05.02.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 02:03:50 -0800 (PST) From: Jia-Ju Bai To: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, cang@codeaurora.org, beanhuo@micron.com, jaegeuk@kernel.org, asutoshd@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] scsi: ufs: fix error return code of ufshcd_set_clk_freq() Date: Fri, 5 Mar 2021 02:03:43 -0800 Message-Id: <20210305100343.14304-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the list of head is empty, no error return code of ufshcd_set_clk_freq() is assigned. To fix this bug, ret is assigned with -ENOENT as error return code. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- drivers/scsi/ufs/ufshcd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 77161750c9fb..79899acb3ef6 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -970,8 +970,10 @@ static int ufshcd_set_clk_freq(struct ufs_hba *hba, bool scale_up) struct ufs_clk_info *clki; struct list_head *head = &hba->clk_list_head; - if (list_empty(head)) + if (list_empty(head)) { + ret = -ENOENT; goto out; + } list_for_each_entry(clki, head, list) { if (!IS_ERR_OR_NULL(clki->clk)) { -- 2.17.1