Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1656300pxb; Fri, 24 Sep 2021 09:06:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwyvqC0Ghx97fhocw/48mAdl6Fh12FTlFyrCtuGeL4rykwdUpt1bK69fLAfzSt6stGanRG X-Received: by 2002:a05:6402:510b:: with SMTP id m11mr6152159edd.82.1632499594552; Fri, 24 Sep 2021 09:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632499594; cv=none; d=google.com; s=arc-20160816; b=m5kHWsUXvbxyhOBxtQAiOXMK6BkNlo1F8LuMuqVI3/JrCxejDiPgeZKcmRNvxP5Gzi Z5Gy7GHxSZrYCdmlaQxeBOn5qNhhWoTOQdHut/+f+BMrJxyJ1vhuvIF4ulib5xYnl7VL ZlQlFEca0OeSkDybETKLXM271u/n/CbKBeogCvsiHvNm52i96qmIxmR1Rd5unELsZtBM fOgCfiCGElD8IGoY/HTqJsJsXK8Iv/cnV8Rnq17TU7eJYZFIhZtqWHPtzv6Qlif/2aqu KBWogiIOyVedWpT0eV+TBIKNUwPf1zYozx0cmulwbUk5t2iAh+1+p9m4PFiFdOFv2Zhq eMqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=XSnJxfEBt5YWoJGVTt7uPSu776tBxvxqT4EkYhJhjIo=; b=jHRf57eJGWeJTbtVvmxehf3NK0QpmAnLeneVhFMA5soHnwKvdFFP8vIL1EG8AkrfNY HHUnTPr7ENWO3Fsoo6xcPAJyEg7NctwnEGugDNBn6FjP6fEGmWa6yrxlNjTYjI2dOQ8f nWcyFo9ZPV1qIFfLGk+ebTwIwRdDTsQCRZjbVqcqJrv4Fnd7zsAsvUOsXvrxb50KJRGc zW9iI9ysa7CQ/n1febD6lR9uLbcKx6HOzocsdFcko3oQS8D6350yv+URpIXGnJEXwmaw W2erHbloK9V2zNpD0Vbc2OD7usLJkXhbXMhg1iesxnKLz3HX7qG74MDGuiecS9xN1Byr mLsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=IYNSuk1j; 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=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si9982534ejc.456.2021.09.24.09.06.06; Fri, 24 Sep 2021 09:06:34 -0700 (PDT) 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=@canonical.com header.s=20210705 header.b=IYNSuk1j; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347280AbhIXQFF (ORCPT + 99 others); Fri, 24 Sep 2021 12:05:05 -0400 Received: from smtp-relay-internal-1.canonical.com ([185.125.188.123]:37770 "EHLO smtp-relay-internal-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347267AbhIXQFF (ORCPT ); Fri, 24 Sep 2021 12:05:05 -0400 Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 356B540833 for ; Fri, 24 Sep 2021 16:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1632499411; bh=XSnJxfEBt5YWoJGVTt7uPSu776tBxvxqT4EkYhJhjIo=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=IYNSuk1j1yr+CtfY5Xham51abCzKx7pjG+badrdDeTJd/hpLGsnfGWGT9b3/7AUkO z7xi+r3Kn6oJM9K5msyvau+LjdNJ4LeaJo7k8GAJo93roWwDkEa69sEGN/y4/qTWg+ 3X34zwLk9xgbFudV77uUKNzrjeFL4wLW/Wvb8Yi+RY6UMHUw29+cOBILFD3acs/Aqg cA1LRCyx3z/PH4pK7kLBKfjc/Casrcjvgbeyb8R/EC8b4EmyNX/NEA/oZhDxedrac8 vCLL+jR7maoCweBi8nqu8L+pLuWKETUTRJb42ROVH3KBiu077WyeQa8du1FpHVscho LqCh1mTuRlVQA== Received: by mail-pf1-f200.google.com with SMTP id m26-20020a62a21a000000b0041361973ba7so6380364pff.15 for ; Fri, 24 Sep 2021 09:03:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XSnJxfEBt5YWoJGVTt7uPSu776tBxvxqT4EkYhJhjIo=; b=7jzIB0cN5x3D6thUQyTbtffmIebfryHYZ0jHVDTiKskMCHutLUm8Xdl6ej0ATH3efM 6aY9mr7+sK0Z6pxtHJ6HNsKTUmYKBPVjUAauII5yYdaj+9mGl45sef0Abhyk+1OGTNXp fJF1y2pEMGz53VJFihlDUADx3N980z6vFeKYUgqkkh6dyCd5ENwhp1zOyysf2ZhW1kj7 xOVMnDUxAVbPmUiUQBCHzotA3X01jRkqot26o72eesfFP5xxRI/7oyP6elSHJxvmZF15 AV7KjMgwrWtybdzphX+ieMXQDQD4q4l5xCEiSfXWcYvfeakJbnLHUP1EI2aSYXrb30Sn Hcsg== X-Gm-Message-State: AOAM530uS1McJhFiGdlf1G6Ju9YnVxT+MzAJy0K6lNmn5kHUBc7CmVEb feYIvjEwY0p0YaS++Kh1AM2vbUqFBv+qU1yeAvOBqPPUJcM6K3IpsXMCC1G8QA+LOlq8V/mbt4/ biao0zkoWU4KLyxKmeF8c65YnocwBQsqlgw5lT604Pg== X-Received: by 2002:a17:903:234c:b0:13c:7a6e:4b43 with SMTP id c12-20020a170903234c00b0013c7a6e4b43mr9721655plh.29.1632499409579; Fri, 24 Sep 2021 09:03:29 -0700 (PDT) X-Received: by 2002:a17:903:234c:b0:13c:7a6e:4b43 with SMTP id c12-20020a170903234c00b0013c7a6e4b43mr9721620plh.29.1632499409308; Fri, 24 Sep 2021 09:03:29 -0700 (PDT) Received: from [192.168.1.124] ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id c199sm9747942pfb.152.2021.09.24.09.03.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 09:03:28 -0700 (PDT) Subject: Re: [PATCH] drm/bridge: parade-ps8640: check return values in ps8640_aux_transfer() To: dri-devel@lists.freedesktop.org Cc: William Breathitt Gray , Syed Nayyar Waris , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210924152607.28580-1-tim.gardner@canonical.com> From: Tim Gardner Message-ID: <8cdae251-f75e-bde8-a53d-27c77ac624c3@canonical.com> Date: Fri, 24 Sep 2021 10:03:27 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210924152607.28580-1-tim.gardner@canonical.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/24/21 9:26 AM, Tim Gardner wrote: > Coverity complains of an unused return code: > > CID 120459 (#1 of 1): Unchecked return value (CHECKED_RETURN) > 7. check_return: Calling regmap_bulk_write without checking return value (as is > done elsewhere 199 out of 291 times). > 204 regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len, > 205 ARRAY_SIZE(addr_len)); > > While I was at it I noticed 2 other places where return codes were not being > used, or used incorrectly (which is a real bug). > > Fix these errors by correctly using the returned error codes. > > Cc: William Breathitt Gray > Cc: Syed Nayyar Waris > Cc: Andrzej Hajda > Cc: Neil Armstrong > Cc: Robert Foss > Cc: Laurent Pinchart > Cc: Jonas Karlman > Cc: Jernej Skrabec > Cc: David Airlie > Cc: Daniel Vetter > Cc: linux-iio@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Signed-off-by: Tim Gardner > --- > drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c > index 3aaa90913bf8..591da962970a 100644 > --- a/drivers/gpu/drm/bridge/parade-ps8640.c > +++ b/drivers/gpu/drm/bridge/parade-ps8640.c > @@ -201,8 +201,12 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, > addr_len[PAGE0_SWAUX_LENGTH - base] = (len == 0) ? SWAUX_NO_PAYLOAD : > ((len - 1) & SWAUX_LENGTH_MASK); > > - regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len, > + ret = regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len, > ARRAY_SIZE(addr_len)); > + if (ret) { > + DRM_DEV_ERROR(dev, "failed to bulk write ADDR_7_0: %d\n", ret); > + return ret; > + } > > if (len && (request == DP_AUX_NATIVE_WRITE || > request == DP_AUX_I2C_WRITE)) { > @@ -218,13 +222,17 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, > } > } > > - regmap_write(map, PAGE0_SWAUX_CTRL, SWAUX_SEND); > + ret = regmap_write(map, PAGE0_SWAUX_CTRL, SWAUX_SEND); > + if (ret) { > + DRM_DEV_ERROR(dev, "failed to write SEND: %d\n", ret); > + return ret; > + } > > /* Zero delay loop because i2c transactions are slow already */ > regmap_read_poll_timeout(map, PAGE0_SWAUX_CTRL, data, > !(data & SWAUX_SEND), 0, 50 * 1000); > > - regmap_read(map, PAGE0_SWAUX_STATUS, &data); > + ret = regmap_read(map, PAGE0_SWAUX_STATUS, &data); > if (ret) { > DRM_DEV_ERROR(dev, "failed to read PAGE0_SWAUX_STATUS: %d\n", > ret); > I forgot to mention this patch is for linux-next next-20210924. ----------- Tim Gardner Canonical, Inc