Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2706040pxj; Mon, 31 May 2021 08:42:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaZdjANQKVnpRa5a59oMBAPpV0cz7FAasfPHRj4zSQIk/uw5EoUpfRoFwCUZJ1zPIV+kyU X-Received: by 2002:a05:6602:1584:: with SMTP id e4mr17523102iow.4.1622475747903; Mon, 31 May 2021 08:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622475747; cv=none; d=google.com; s=arc-20160816; b=ACNwXMwgLrTDhFkEOgHtVxoUNGSsWDs2LmRMi7zdjVftqahPQB2TYuY/f1Ae3tniyd ZFtw/or7JUewj4xj9PvAsPmqk5vNZL9F2AeL0w/4xg5GDWpfTL/YXYGEvwrLmdJjwaqE ytisUS9cfut0vm8NC8fKPg12O93l1r4MhquN8swqTMQs04vVWcl1jta6/3Xs+oMlErYn n+c/Dgavp0X/2YmQhr7jedX5xoaT4FIw3XvCS005kbWHeIKJbnDnL3S5kRZK0tSndjie D86AND1Rj5Ls2fX633dYv8TVL2Lgk79U1xLkyhIYSLm/K1NOJzFox4KnPKXJStns48e7 3+7A== 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=pu0ldTYN9JPLZ4X4ScYk8Ce1sVxLrQ4wE/tDCYdrkH6jLvwrNp4Kn2FtuqAazArgHC 8YBbgLYQvqGUw/GRe3sKLi/g4UEN/msP6vMKp1L3Hx2ZLJ3SR2LfzfdiiFdeKKpwtRIN F3jJpBbnPVC0CSttixnfKFeLnRD7aZEhpPhr5ICeiz3WBIAZMhwejX2wZJF7UBFqpFQg H916P9HmAwrW/UBs1I+BpRt9RetWGo2zyacahfYOp5Da9VjgcxoGAVTKFD91zTvgSQzv 90t+H76hYUKtad8IkVIlaNWj+UEm15UjV3bA6SHe9jy1uWdqeUvggWh0nOXG3XpO8Lbl 0AuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e6ZBiu5j; 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 h3si14357078jal.79.2021.05.31.08.42.15; Mon, 31 May 2021 08:42:27 -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=e6ZBiu5j; 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 S234480AbhEaPnB (ORCPT + 99 others); Mon, 31 May 2021 11:43:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233287AbhEaOXd (ORCPT ); Mon, 31 May 2021 10:23:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F809619D0; Mon, 31 May 2021 13:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468759; bh=lGqqaLBNP/9QRAroFbTLl3k3cLDdzW2qBzFiLQ2qiP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e6ZBiu5jkc6mDzo1M3xkJ+TOydAH+xQjUR+9zZgu+bRchd0OI/bxoUKI6bexELeQZ +Dv/oSK+7JcJzvEmKIHOuJdc9ey0PdExtlKxN/rZzFrgj1wqbcD0JtNzlB0knAqg5p Mf26OTKtVGVxkLVCGu9JdSm3N5aqJtWH7BbTHHqk= 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.4 116/177] media: gspca: mt9m111: Check write_bridge for timeout Date: Mon, 31 May 2021 15:14:33 +0200 Message-Id: <20210531130651.918846570@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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