From patchwork Thu Apr 1 09:15:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 413553 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp384087jai; Thu, 1 Apr 2021 02:16:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCWmh212RA0QrsIMgh2Cfzi6mPPDV+0bcsE4/PcUvvV8FiT8iostv9li7wWjXU1gVgv0sn X-Received: by 2002:a17:906:13ce:: with SMTP id g14mr8145980ejc.378.1617268559995; Thu, 01 Apr 2021 02:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617268559; cv=none; d=google.com; s=arc-20160816; b=HcWz7x4fM3PpEZLvvWCdzl4W0A6qGZOyexzTzNbPGKMRrJQTtvYMivdwSxMxMFNF/h uQeDkb48ceCBscc5rhwT30dkfl8JUafLfmcUbVQqDn/SKiro9hPl1DolHhohXS3GiJzE cvb/KWzjXTqoxzKpFY4nvZyoYm5XWEi9V5NPV8we4UYn3PZLDpsv8902+i6ilSoD8AG6 4+uKg0tGjS3yetHEPzxU7Mhjw51IndzbHfcw0L+C1pbplWeJY5kmfwfmdJysaV2Syz36 6QijzahYzUubmRAg2PNn8xdvcyUET7iQ4X70YwqeXP7YQG/ZHNLzd3E1TxitcZ9W0YDY UnvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pFG46RZYS5/Er5IhYN0FXoPQG4BJ55RdCsAsKwMxydU=; b=zmH7utxh85ruvke1JN/0jFQ1yDLNS8H1pLX/qqv53+1OF1xat+/VkEJnZ983Llej48 fYhrVgbj+r6toDtHc/au5IqgejDLkCXZTVGSNxsgD+PClWW2pR8DzzXyRxyAk9xTuRTD kL+wLBog8u2pfLMrtiAMu7QI/TUrVpS+aoD7gv1s85NmwCNN3Q0W5jyXX6n24KmmN6EG D327shxVn+3tEJeFwixQ8lCTd8Q4jdA0RvqBX/ZjQf+OPDg32K+CYCrApb6CT2YK6CP6 HIqx2OkARAfXEOxHOlV/XgGw5MJmFxKy4gaBjJKF/qgVg8yQiBse4yMOUDv0tSwGtrOf eM0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WlIUaIoc; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si4085128edd.73.2021.04.01.02.15.59; Thu, 01 Apr 2021 02:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=@linaro.org header.s=google header.b=WlIUaIoc; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233842AbhDAJP1 (ORCPT + 6 others); Thu, 1 Apr 2021 05:15:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233921AbhDAJPH (ORCPT ); Thu, 1 Apr 2021 05:15:07 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1712C0613E6 for ; Thu, 1 Apr 2021 02:15:06 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id h10so1106134edt.13 for ; Thu, 01 Apr 2021 02:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pFG46RZYS5/Er5IhYN0FXoPQG4BJ55RdCsAsKwMxydU=; b=WlIUaIocYVvnh0DL8RSf6KBIjvTv7HVcs95o9YIu6r52SNIk/q5QYyzo6GDWE7LpHl lR+440cF3MLZmzmFSaH3P9x4WQwFDS6ENhwfuXULlj5hybDGIP+dlB7jQei4ezvaeyd3 yDhoytWciC4lLk0eIVlHubjybZDxMHTt8JZ2yEM/vp1kfdLTC8yXJ+Oc2m9MYkTXuKTP iCMKopCKSg472suxVqhLV27KQrJwZO70iCfBNK0w6fivTHp4O7/7EFKJory3jbuTdADf MuETethhOuwgJ/Ks0xr03ATL+oTF3xU+mzUimorr0vLA+vke1rCsqUHZAhKHoySgwSQz iKAQ== 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:mime-version :content-transfer-encoding; bh=pFG46RZYS5/Er5IhYN0FXoPQG4BJ55RdCsAsKwMxydU=; b=UtO9VvphKND3AVcknrCrvRvCpqVTsCPQAKThXyTcy9XCG9NX/oSXYdmkoumZbV0K7r v1IQHMhvRsasUEFl93FZxDJBgBDvbZ2uiMbj3UXBMrtIt/Gz83Fn3kZmL/DqbWHzHh0u hD7HqD9UZfhiYXqVKrUdzT43RN6NNXR0tA9h3/d/qcm3xNaXGrELf1e2u2T5Gi9gOYGN 0MV8VU8w23/KBG9hXQc28+IJ/eLvWlM7JGg62nDGSCRQjgJJDqidZ+5bImTvHv4fZ5mJ PadXQ5zcw00ZXRUqMrPAzzVz4kA3rubCeVxYdu79bbM/lEBxEipRE4TVBYDVtWTyWwZx p/8g== X-Gm-Message-State: AOAM531pUUyC0+xSd4yjap2cIvvffJ21tJYbQk0qU+Ww0ZvBBwnnzgTi 8ZkmFf/UoHZJhjgbWNNBSu40vA== X-Received: by 2002:aa7:da14:: with SMTP id r20mr8590863eds.181.1617268505387; Thu, 01 Apr 2021 02:15:05 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id gb4sm2426802ejc.122.2021.04.01.02.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 02:15:04 -0700 (PDT) From: Srinivas Kandagatla To: vkoul@kernel.org Cc: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, robh@kernel.org, devicetree@vger.kernel.org, Srinivas Kandagatla , coverity-bot Subject: [PATCH] soundwire: qcom: handle return correctly in qcom_swrm_transport_params Date: Thu, 1 Apr 2021 10:15:02 +0100 Message-Id: <20210401091502.15825-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Looks like return from reg_write is set but not checked. Fix this by adding error return path. Reported-by: coverity-bot Addresses-Coverity-ID: 1503591 ("UNUSED_VALUE") Fixes: 128eaf937adb ("soundwire: qcom: add support to missing transport params") Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.21.0 Reviewed-by: Kees Cook diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 5fd4a99cc8ac..348d9a46f850 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -731,17 +731,23 @@ static int qcom_swrm_transport_params(struct sdw_bus *bus, value |= pcfg->si; ret = ctrl->reg_write(ctrl, reg, value); + if (ret) + goto err; if (pcfg->lane_control != SWR_INVALID_PARAM) { reg = SWRM_DP_PORT_CTRL_2_BANK(params->port_num, bank); value = pcfg->lane_control; ret = ctrl->reg_write(ctrl, reg, value); + if (ret) + goto err; } if (pcfg->blk_group_count != SWR_INVALID_PARAM) { reg = SWRM_DP_BLOCK_CTRL2_BANK(params->port_num, bank); value = pcfg->blk_group_count; ret = ctrl->reg_write(ctrl, reg, value); + if (ret) + goto err; } if (pcfg->hstart != SWR_INVALID_PARAM @@ -755,11 +761,15 @@ static int qcom_swrm_transport_params(struct sdw_bus *bus, ret = ctrl->reg_write(ctrl, reg, value); } + if (ret) + goto err; + if (pcfg->bp_mode != SWR_INVALID_PARAM) { reg = SWRM_DP_BLOCK_CTRL3_BANK(params->port_num, bank); ret = ctrl->reg_write(ctrl, reg, pcfg->bp_mode); } +err: return ret; }