Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2744124pxj; Mon, 31 May 2021 09:38:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt3F2as5MPntXmctydfjYa29g1ZQa1d26mOC38rAkRjyNTIeWF5x7Rxf5sRnUKPTfqIN4t X-Received: by 2002:a17:906:848c:: with SMTP id m12mr7177695ejx.330.1622479099348; Mon, 31 May 2021 09:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479099; cv=none; d=google.com; s=arc-20160816; b=rImA8A45ECeUyqvJODcNrN3UEurkgXIkokbUkjLPkhUJD+xBlu+UpuYVZRuNWXL7Y6 7Fh60kKNMN4M3Fz/wBJNyrDXORQrmSmu2H3PMc+Wnw5ORgT2P9lZ7T+PbJUnrJabhBl0 QytxG5cLAL6dytSt/UCdX4YmfLWb8581ImhaUIA+Cj2J22VL1mkPJ5jvRpvc8aerS70z gHnUk58oNcTeR+rOS/1HqzaSPlbL31oT4HPwrIS/WcEZBwZe8xBGVdgaTDtkvHmiR39a 59r+5sQucPwpr/1KOyeY6c+fCHWcADkPcpMG3LZ7q+0mDC9OO0z0Jac47Bx4IvBatZMn qZaQ== 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=o4jf5ZkgPIMa7G1ZPz9vRhMffuHotPaQU28PTaOCmKQ=; b=zP3iqXFcyfbrma1UfNwgKwTkXTGFvqbLeEnSEBmBPqkdZrpEQGFzihjx7PvCgOzO9s UkztsoSkvkrHpClIpV+VupiDfCGXH8p8BndR1BiHdmkUqHwvKn8vuOc1i866CwuR2wtX idopbqcmQobtlNtns4LwTf0v+ZJ40dxCqYl0jkXQ6kj2S15pYSgLfQi3jXtamWV+Pm49 O7g/kmWZIc8ewtqeYLMx9u+2OIj98n+MVZNXOz4/O8KT6g9ymt9H8AQhzKKXXusRioZO 8QC1HXAKMnht2rB9NSlyIEEZQl8eo9A6rB4wAi4yz/UQ29puCNr8tOL3ChfznVZRUib1 sf/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tb1XqJiZ; 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 f16si6808616ejc.261.2021.05.31.09.37.45; Mon, 31 May 2021 09:38:19 -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=tb1XqJiZ; 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 S234387AbhEaQiH (ORCPT + 99 others); Mon, 31 May 2021 12:38:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40790 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231411AbhEaOtl (ORCPT ); Mon, 31 May 2021 10:49:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8EFEA613F3; Mon, 31 May 2021 13:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469432; bh=/5mkWMxrniQRM0OIO+l/RFMqZzon2mnA8svi+4FOsBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tb1XqJiZf+RcO/IRPEFsI/zkxoasOj/t0swu6WOTOHmSToPiibpaB9IQNAWfm7QHh o6FFMxcZAv2qkMxVXkWwPWuB6XC26noZJfPsLWmBgPUbv3RCvQWZTzcQu99zVTRfHJ GWib79DMLcIEftalivuLO53JZshNLom/V4GtYOYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.12 195/296] media: gspca: properly check for errors in po1030_probe() Date: Mon, 31 May 2021 15:14:10 +0200 Message-Id: <20210531130710.430819134@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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: Greg Kroah-Hartman [ Upstream commit dacb408ca6f0e34df22b40d8dd5fae7f8e777d84 ] 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 Link: https://lore.kernel.org/r/20210503115736.2104747-64-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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.30.2