Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2623844pxj; Mon, 31 May 2021 06:49:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYdahYM+9h7G/8A2SRbyy/feNtHsXBzrzE2bSVoqvwH0TKyZEYA7wIOeXFFImLCTTkpX2a X-Received: by 2002:a5d:89c5:: with SMTP id a5mr17694083iot.172.1622468973917; Mon, 31 May 2021 06:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622468973; cv=none; d=google.com; s=arc-20160816; b=Z7nU9I/TZt+lbm8pJSi5lFm5btq7MHm5LYWd5sv5aqU2MigwjJoPXOh60FJ2kZOyGU tkk0hnKG6EAjHakhwNPu1d0dMB3FXPzT5fGDhS3VOJFFNVDAVYvUpmwIyL+pUs3VHfFB KrkaQDC999QsOJNQx3K4HzVzdTmQWRmhLczehPzAo3Ahvpaoc8TFM/okkT4Te5RAqnK8 d9PB3pkYHxkwrkcl4x6hkRh0Qmv0gbRgqId7VQDsLupX9Z7nEX9S+MPFgSYMOFZrP1GB Imx+UJRhk9736xDCyIoYf94zYXor2+oLigI3kqw/a5U6/mCnqRa3WyBgqXg1LH5377ih osqQ== 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=9YTkydys8thNGLO3J+r4Jb4XaPMYaSDx25N8CC8XHE0=; b=tJeJGQwonGQuPWhd3o5j60TPRHmPzYYAXQzxZkgOoeDNn1BFc+8ifOHdzpQFDkYfUU q3IC5WE4tFp4/bnH3f9PfLinT3T5/1NWHMf3CGbyOg1SQ+ltxJX1mX2C+gTsDreqTZCz PVXgpt1KIokF+C5tsiUL35c1LWyB3b65UItwVRJiPYeqAa7KWCq1qLYz1MuPZjmCu3wE N3qUBEzo/h2seagWvu2Jns49wXrm+FCxPUvjCduuZYgUMHziwPxhGnVj2fa10fBqrT7w blroy0Zxes28kuBVCDi8tvF2PF+wDrmA0t172rh8TkQj/CNgw95MzXNvvkpOQBnsoTQR BNFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iUwVJk+I; 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 j11si14422565jat.42.2021.05.31.06.49.20; Mon, 31 May 2021 06:49:33 -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=iUwVJk+I; 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 S233018AbhEaNtr (ORCPT + 99 others); Mon, 31 May 2021 09:49:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:40220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232709AbhEaNeV (ORCPT ); Mon, 31 May 2021 09:34:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4974161445; Mon, 31 May 2021 13:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467491; bh=6ojWN7MjokRzrhXaTS7naqgOE5nUzbyfaJtwki3P4lE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUwVJk+Ilbp3hBADR0/iILKrMuj/tteW0YsW45WsiEGsul2VIoj+yMe9F11vZ922G wVeXit7PvsqW/Qzo1LrspkT4ujjUCgt5C4+q9vlZtIMyIY/Ik5Xl2oQc5KW0MswOJ5 QQEkOIhzQFX0XsZIJebFPB+0PRJVco3LPHdideF4= 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 4.19 086/116] media: gspca: properly check for errors in po1030_probe() Date: Mon, 31 May 2021 15:14:22 +0200 Message-Id: <20210531130643.067018381@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@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 37d2891e5f5b..81d8eb72ac41 100644 --- a/drivers/media/usb/gspca/m5602/m5602_po1030.c +++ b/drivers/media/usb/gspca/m5602/m5602_po1030.c @@ -159,6 +159,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) { @@ -177,10 +178,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