From patchwork Fri Feb 26 23:22:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 388306 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AFD5C433E0 for ; Fri, 26 Feb 2021 23:23:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42B7464E4B for ; Fri, 26 Feb 2021 23:23:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbhBZXXQ (ORCPT ); Fri, 26 Feb 2021 18:23:16 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:34201 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbhBZXXP (ORCPT ); Fri, 26 Feb 2021 18:23:15 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lFmRK-0001eh-2t; Fri, 26 Feb 2021 23:22:30 +0000 From: Colin King To: Sakari Ailus , Mauro Carvalho Chehab , Arnd Bergmann , Srinivas Kandagatla , linux-media@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: i2c: adp1653: fix error handling from a call to adp1653_get_fault Date: Fri, 26 Feb 2021 23:22:29 +0000 Message-Id: <20210226232229.1076199-1-colin.king@canonical.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Colin Ian King The error check on rval from the call to adp1653_get_fault currently returns if rval is non-zero. This appears to be incorrect as the following if statement checks for various bit settings in rval so clearly rval is expected to be non-zero at that point. Coverity flagged the if statement up as deadcode. Fix this so the error return path only occurs when rval is negative. Addresses-Coverity: ("Logically dead code") Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses") Signed-off-by: Colin Ian King --- drivers/media/i2c/adp1653.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c index 522a0b10e415..1a4878385394 100644 --- a/drivers/media/i2c/adp1653.c +++ b/drivers/media/i2c/adp1653.c @@ -170,7 +170,7 @@ static int adp1653_set_ctrl(struct v4l2_ctrl *ctrl) int rval; rval = adp1653_get_fault(flash); - if (rval) + if (rval < 0) return rval; if ((rval & (ADP1653_REG_FAULT_FLT_SCP | ADP1653_REG_FAULT_FLT_OT |