Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2713726pxy; Mon, 3 May 2021 06:29:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz80B6LfkXq2360HQoQ6EgkwtMaIkDJ5p3pCimJWMb0PKDYoCV3z7zV3J9IF8bt7Ixc9Tt8 X-Received: by 2002:a17:906:b7d3:: with SMTP id fy19mr16529598ejb.269.1620048587512; 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=iHJ9ZOgt1GN27C5+MB6+4QXD8AkKYGDS/+nbOqrDYtSJ1gEOqwolqYwwDwfvrSseQ/ zYbSe9pUzG9q6jheyh2xuOZrXQx69YnURwktNqzbEvM/nGP/gbrebx4hldlUWPYS+osf TwEp+PlgU6qUyw77pIXOM8qmcxFvrh6y/tny1fFdwUnQ+/VABl2MSt3Es/Xcf+Z14Y4Z vw+4+n4gSyrigrx2QQ++YOjtX8lNjiUE2+hjMZvwhkddQzy3pdrWJhcU+oOZcIsXFWzc Z3YH1PqEO3/Oea5q8vFRsArhi65fxQQzJuXDGdGVRfWNhtzO3S3+W97veobqAbwwITET Zjbw== 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=hnbtwMUbLRmAG8EnVhOD4CZ9CsjoJacVDIbw6bHP7/w=; b=mORHtjwHiLFGrbX5Hw5xBQqDfZR2wGBk2orB3Tl1FKUGt1hk6eiGSLIK+tlIBeW/kZ V6I3VpYHTw8/fFL3UY/Xm5K2nBxngAuG1g6PNBkQ4joQHLLc0eqzKZFpNazeutucB9qJ 19QT2Aqi6BzNRUQz+7C3yO/O0V3NF1XSsDNvx+9fM2JFTkr3yKMdS8SdyXSmemkkjU2q r7AmnEkqIb0tQTb/kLS+OGu4NSn8qitmxdjx98+bqW/yM8qkDCyQpM9F1AGdCsdh4TqA 2I1THzKtJ3ArhYmf/JcNDZ5I7R25Oibmzq9a1VMdMpQFzMmxNHzBosUCsEPkNSEOctZt i/yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FecNRYu8; 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 o6si10390356edi.18.2021.05.03.06.29.22; 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=FecNRYu8; 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 S234195AbhECMDG (ORCPT + 99 others); Mon, 3 May 2021 08:03:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234015AbhECMB4 (ORCPT ); Mon, 3 May 2021 08:01:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45EEE61363; Mon, 3 May 2021 12:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620043263; bh=mJSpTrYwQAVyJRu3mCpaRuhSuzjwqLXnPlUnq5kkM80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FecNRYu8NL/BRhpGnRgQFVB6oQcWHPmMOfoHz8njw7SmwpjHhN5ezuig/QR/f7ENk 7ESwwTQupPJ34Jn3NuMHQbefW9reAkeG23k3BRo+IRiUwCJTQyDVDz+Z4OpRCcJ4QC OdYaLw80GivPrrBC52+aNJ/CRC7GVW96NtNAIDZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Mauro Carvalho Chehab Subject: [PATCH 63/69] media: gspca: properly check for errors in po1030_probe() Date: Mon, 3 May 2021 13:57:30 +0200 Message-Id: <20210503115736.2104747-64-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 If m5602_write_sensor() or m5602_write_bridge() fail, do not continue to initialize the device but return the error to the calling funtion. Cc: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/gspca/m5602/m5602_po1030.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/gspca/m5602/m5602_po1030.c b/drivers/media/usb/gspca/m5602/m5602_po1030.c index 7bdbb8065146..8fd99ceee4b6 100644 --- a/drivers/media/usb/gspca/m5602/m5602_po1030.c +++ b/drivers/media/usb/gspca/m5602/m5602_po1030.c @@ -155,6 +155,7 @@ static const struct v4l2_ctrl_config po1030_greenbal_cfg = { int po1030_probe(struct sd *sd) { u8 dev_id_h = 0, i; + int err; struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; if (force_sensor) { @@ -173,10 +174,13 @@ int po1030_probe(struct sd *sd) for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) { u8 data = preinit_po1030[i][2]; if (preinit_po1030[i][0] == SENSOR) - m5602_write_sensor(sd, - preinit_po1030[i][1], &data, 1); + err = m5602_write_sensor(sd, preinit_po1030[i][1], + &data, 1); else - m5602_write_bridge(sd, preinit_po1030[i][1], data); + err = m5602_write_bridge(sd, preinit_po1030[i][1], + data); + if (err < 0) + return err; } if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1)) -- 2.31.1