Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1850026pxb; Fri, 5 Mar 2021 00:49:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHOQpc7H6wCC+KS21IcfA3HbCC9NVdIYBWiTeYkaXagkVWZJEwbgGeT3UrA7gtxflddfBI X-Received: by 2002:a17:906:7b8d:: with SMTP id s13mr1375323ejo.247.1614934173105; Fri, 05 Mar 2021 00:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614934173; cv=none; d=google.com; s=arc-20160816; b=SG1DkL+9DRnib17HmhA3FnpiYntjMVpDT+f222qTSDKCKIJ+he4Bj174D+3Jw1h+/t pOD33L+6nQx8iWsVIyXkTVfJ/hyijzfuZadEUC4SFLS45cRXUh7zxF4MpSR9mi1yLQKA Vwhyef+OQgx0ZudDQmIyCG+FUShgrt3vWs2DCQP3k6SJXHf322mD4+u8XlB86QTFdUab 1GpD0ugz7/jyJfdD2mL1gtnMIgjBvQ3f7IakBKFUzKP5cib6Bsfsx+8qaGWikmD2RMba eAG0cYaSPgH6aXc36yfVrz3+x2C/CVZGRH+Aq9WzPIu1az681B+lSalktqWxbh6XJo3u GaNQ== 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=iXKUWbmSLel/CjieMrQtXA0OopXZ8i0L9q59UfEsA0s=; b=lmVsxai7FNSufhf5WrcMMub1kRDEuYgYfh9MDIE4MSnOqu2tqnUiRgmG0V3AkOf00I BrULrTgaFLsuH9GhraLt/P42xREKai5gjCao67HWbP9fQbaxPYEQlgpQOWVmAPMRkS/7 xjmQ1D+Tg7gVT7Jx1HPenhoJkQlor0H7oXN1pi4jjOtCBshnr00G1LoCg18ruC+rQaoz od1hj8H1uCkIcVNPZG6kGaA7j7fq0dw5OZsUfCdD/hkpM5qQED5c12RdEMOq2/0qEqtg 9+h4QDdu5TRvlCsF7nNC8eirmh2cFgA/f3oueQOzqbv4mgmI8+vbZRHgtT5K2AhqUUU0 2eAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=skX3ruyx; 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 jz18si959416ejc.575.2021.03.05.00.49.10; Fri, 05 Mar 2021 00:49:33 -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=skX3ruyx; 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 S229517AbhCEIsD (ORCPT + 99 others); Fri, 5 Mar 2021 03:48:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbhCEIr1 (ORCPT ); Fri, 5 Mar 2021 03:47:27 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF9B0C061574; Fri, 5 Mar 2021 00:47:27 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id d12so1594708pfo.7; Fri, 05 Mar 2021 00:47:27 -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=iXKUWbmSLel/CjieMrQtXA0OopXZ8i0L9q59UfEsA0s=; b=skX3ruyx3cB6ZanqDYCAHTQzs+jzI4cnVjOOexKNwYf5usKc8EbUNNMoJGI/3KR7dC +9QnguEddejP6D60EtKXdYKgHejnXZbHHZOiyUq7hpdpmp2Pcfu8xpWSQsBQ0Ng/Knq3 PEQBDGsOz5ZQXdQb0pWHw5602hr7ICNobyzdDnWBJrED/bMVbEQsEd2n/sdwi21QqB5Y +9KGQaQ1U6G7pD8qqZLVrRruFbHIQLfHKr9I8Izse9DoPMUbsNsw5N2NJXsCIihUanjO Z45AjsJ5j6Wz3vxsdsNKigadJUpyDq+sAMWwv6GFEhyjre5ZuecAWkaamN46wMqbVdXK 8KQA== 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=iXKUWbmSLel/CjieMrQtXA0OopXZ8i0L9q59UfEsA0s=; b=rdcQaao0XBNbN5ZMTMQ0nozXei4CGBBc1QZQDJTQg2bQXdfbzYf1axGFmAHwDykLCo Legjo3j2qEKmi+n/ngLszPQnVsgnpqKsHOaSzCJ9iZlwmESTjx2jFkyc3kLtJ1bJfji9 oKeylA4iWdAVnj8k7rqRBtsEbZ0aeu4aij4lU5ds/bvc7IE3iGdSixNkCP9ntnwdstYS mGNC0LIi0Do6UYY93gAxWUuHqsUhzAbTQUJY3+H09zgLizhtYM9Vft06sVXZLzOaWXNe JxXgfQ293gOceq6CViYtzVAOK/zhzu1UKHtVmZloBrr7Eh3V6w9eyzOuS8lm5e44vYlD mtJw== X-Gm-Message-State: AOAM530ff83v2p49ikmBx1KznedcZEJVaciEnfaUJd5iX1ejBkwv4j+j sbfYMHcNDXejE6JonaPmtEE= X-Received: by 2002:a05:6a00:886:b029:1ed:b546:6d1f with SMTP id q6-20020a056a000886b02901edb5466d1fmr8202804pfj.22.1614934047345; Fri, 05 Mar 2021 00:47:27 -0800 (PST) Received: from localhost.localdomain ([45.135.186.129]) by smtp.gmail.com with ESMTPSA id js16sm1664393pjb.21.2021.03.05.00.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 00:47:26 -0800 (PST) From: Jia-Ju Bai To: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, stanley.chu@mediatek.com, cang@codeaurora.org, tomas.winkler@intel.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] scsi: ufs: fix error return code of ufshcd_populate_vreg() Date: Fri, 5 Mar 2021 00:47:18 -0800 Message-Id: <20210305084718.12108-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 np is NULL or of_parse_phandle() returns NULL, no error return code of ufshcd_populate_vreg() is assigned. To fix this bug, ret is assigned with -EINVAL or -ENOENT as error return code. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- drivers/scsi/ufs/ufshcd-pltfrm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 1a69949a4ea1..9f11c416a919 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -113,6 +113,7 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, if (!np) { dev_err(dev, "%s: non DT initialization\n", __func__); + ret = -EINVAL; goto out; } @@ -120,6 +121,7 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, if (!of_parse_phandle(np, prop_name, 0)) { dev_info(dev, "%s: Unable to find %s regulator, assuming enabled\n", __func__, prop_name); + ret = -ENOENT; goto out; } -- 2.17.1