Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2713728pxy; Mon, 3 May 2021 06:29:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvOFmT/7J96iUPZ3CREAJ9T2ZkCd95XLHEELOYbRtgKAikDqOM50JpPBLyevdMuwl7Y1zQ X-Received: by 2002:aa7:d3c2:: with SMTP id o2mr19745295edr.111.1620048587511; Mon, 03 May 2021 06:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620048587; cv=none; d=google.com; s=arc-20160816; b=u7mxi+yWFqC9i7TROFaqjo7MQjBRgpCaDPa/ga+78WucLa242MwEq732KCJ2a7Bu7s 45fGduRnQyp4ktzgW5zcyzRjp6z2wgdAzAFVXDddujrEP2i5qGAooa2/GiCESievopra Y0E6gjOl+Dz/nBvtOU6GlW+A/xktn2PK1mnDr90Y9eXtRU0xErF8pPFpWelSWX2mynAl sXU3jLtumcVldrQUY7oTHNPD5LZQIpX2DzAIfGiAVFNQea2/rRDO8IQQ9QS6ZA7qfza8 uvoTKTahxrw4j37gErQz+It63zDbF5cavy4ExZkZAs78S5Syic74ZCeKXuoV2Jeq0vRu eNMA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WM2ojdKBRSoU3g4EtRDL+cd1eynyp0VkG+ezsL/cDW0=; b=shP6aUO+TXrvpL2r6wVJjxf6ikMHaRdVrK+PeXmjt5GKfVqz12LwoVFfjzQI6F3QtU N3Oolh8eV1TP9kEwTj0n6U9h+677cpVKmfwSDpwnYBr0b81zb27S4Y5uYLkLIpxvNWSw F8gCLok2Tyi2xCyN52V4vLK4Ez+sqWbs37kmsOUDJrLTyCz22+gZ3IEf6EeXGlp1NcXD wr73qFKdm/7dG78/w3y7dJ+L5hebErQm53evee9a6eQI2hIUGDMqCo665S42/mreE+rN yqpDWhpde0Uq/NJzU5QY7hMDxuph3o389/oF0dBawUGOu+BYuRP9Clb8k+bPxq9LeMVm 1Gdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TsMgVTtq; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si8497395edx.417.2021.05.03.06.29.21; Mon, 03 May 2021 06:29:47 -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=@linuxfoundation.org header.s=korg header.b=TsMgVTtq; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233814AbhECMDA (ORCPT + 99 others); Mon, 3 May 2021 08:03:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:36736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233998AbhECMBw (ORCPT ); Mon, 3 May 2021 08:01:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8520961278; Mon, 3 May 2021 12:00:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620043259; bh=2XLnbKYGw70eB6socMJH1tAOUlUrIj0bitV95Pn6iR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TsMgVTtq/kXQWLCAE7cbA4jcTnsCCf1B8/GPp7ewKWeqFQgT33ZFCJEFeAnW9jOab 7vd4hccv+QaqDLvPoe0OQWx0Dp3+oKEy4x8/TWqgZRBL1LfetvLfz8blFyFcOH6fTE ULm8FLXfnQ/Qup3CcubsjEHfNjf4lze//SnjNYok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Alaa Emad , Mauro Carvalho Chehab , Greg Kroah-Hartman Subject: [PATCH 61/69] media: gspca: mt9m111: Check write_bridge for timeout Date: Mon, 3 May 2021 13:57:28 +0200 Message-Id: <20210503115736.2104747-62-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210503115736.2104747-1-gregkh@linuxfoundation.org> References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alaa Emad If m5602_write_bridge times out, it will return a negative error value. So properly check for this and handle the error correctly instead of just ignoring it. Cc: Mauro Carvalho Chehab Signed-off-by: Alaa Emad Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/gspca/m5602/m5602_mt9m111.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/gspca/m5602/m5602_mt9m111.c b/drivers/media/usb/gspca/m5602/m5602_mt9m111.c index 50481dc928d0..bf1af6ed9131 100644 --- a/drivers/media/usb/gspca/m5602/m5602_mt9m111.c +++ b/drivers/media/usb/gspca/m5602/m5602_mt9m111.c @@ -195,7 +195,7 @@ static const struct v4l2_ctrl_config mt9m111_greenbal_cfg = { int mt9m111_probe(struct sd *sd) { u8 data[2] = {0x00, 0x00}; - int i; + int i, err; struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; if (force_sensor) { @@ -213,15 +213,17 @@ int mt9m111_probe(struct sd *sd) /* Do the preinit */ for (i = 0; i < ARRAY_SIZE(preinit_mt9m111); i++) { if (preinit_mt9m111[i][0] == BRIDGE) { - m5602_write_bridge(sd, - preinit_mt9m111[i][1], - preinit_mt9m111[i][2]); + err = m5602_write_bridge(sd, + preinit_mt9m111[i][1], + preinit_mt9m111[i][2]); } else { data[0] = preinit_mt9m111[i][2]; data[1] = preinit_mt9m111[i][3]; - m5602_write_sensor(sd, - preinit_mt9m111[i][1], data, 2); + err = m5602_write_sensor(sd, + preinit_mt9m111[i][1], data, 2); } + if (err < 0) + return err; } if (m5602_read_sensor(sd, MT9M111_SC_CHIPVER, data, 2)) -- 2.31.1