Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2667562pxj; Mon, 31 May 2021 07:49:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFMfOUS182BCg8VnSGOPpKvOpHOh0cG0i2IXxmiyGJ1TuygsP2rAjv7Mcb9x4PQcX/6LmB X-Received: by 2002:a92:2a09:: with SMTP id r9mr18125751ile.300.1622472577913; Mon, 31 May 2021 07:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472577; cv=none; d=google.com; s=arc-20160816; b=yW7hZeIbEe9jGgXiRh4DXuUYw7pQQbZFqLWTkHvHNvHcVWrNHKcoypvfKf6jn7FCIf 4up+V4EfYXnAZlTlom8btLEye3Wbd32qem8V1jIuOJuFVKjq10XzzFUtRpXJQANAmDoB vWWRbNkvxP+v9XuwcnxYo+KMHx96HKQeI+LU4baQleZyXOfpCzLpLjzPv5m5v0YTf72Y EoNghdRHbVTzK2u6hyvWf8WGAght2D3Z/oxqQetp231IB1LNvRsdvsLO3OVJbx7nKVhF IHRcOcQyT+EmoN7kRfxyZN6F8LFn3zZNLstuGDwGkTxKQO94jLDDJQP+tEkYNNNbdoRL EHOQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Bk1/bSMCoDZqBgiPwYdIWSaBD3uDHjlnEStZVytvZJY=; b=ihHqE39jkuL0KpNS+YFie/VRMgwUFon229/DQ6WGEwbmvr0vbDxiMsNuHif4XS6W7H j0KtKzJd11NUWTUqPt/qhXfNC+sifh/Mb22C6K1C8SJ+MkPihXGxv3Gt4WJe5jm/LINy /iLkCqK53gUsE0eEaDKE9CYOgKXCEPVaCt0oR5g4E4nn9LVYatUTM5mPwdMrM4EbxyNV 2uL6JhkrjDpoDw4AxHWMK99TvQhx+fgr/hFoFOFLpJPFqIRfK1pTyGVYncSQh/KjKJco VhETwFNG4O3VAdu7rBI3Vhfr+iG/pPkeI52GGNCERDQJtQy4jC2ExT3TtOksnVR+W5DA YZiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="bHfMlo/M"; 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 t14si13966486ios.45.2021.05.31.07.49.25; Mon, 31 May 2021 07:49:37 -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="bHfMlo/M"; 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 S231330AbhEaOub (ORCPT + 99 others); Mon, 31 May 2021 10:50:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:37386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232862AbhEaOB4 (ORCPT ); Mon, 31 May 2021 10:01:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 786FA6138C; Mon, 31 May 2021 13:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468222; bh=lGqqaLBNP/9QRAroFbTLl3k3cLDdzW2qBzFiLQ2qiP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHfMlo/M6WBYci6+RPPep7tOLBS3/CCLUFauoCqbGaMDJPJAf7Q3mqT7sPb0MvRBo MtXqCXM/K3rauwDc1Q7fX8yGSGy4sLowNzqp01r+MsJ/7LjiCrhlXG67+V6tGx0kH1 la1V9LY/OSOQevLHwKqqaggVe0vdmh6feu1t/aLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Alaa Emad , Sasha Levin Subject: [PATCH 5.10 163/252] media: gspca: mt9m111: Check write_bridge for timeout Date: Mon, 31 May 2021 15:13:48 +0200 Message-Id: <20210531130703.552806031@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alaa Emad [ Upstream commit e932f5b458eee63d013578ea128b9ff8ef5f5496 ] 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 Link: https://lore.kernel.org/r/20210503115736.2104747-62-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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.30.2