Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2637321pxj; Mon, 31 May 2021 07:07:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4itHlEJl3iWk9bJ/3wopVjQbUCSXloofuTZbbYMFR94Xel0sSOCedYg2czkHefDj9Hv0o X-Received: by 2002:a92:b506:: with SMTP id f6mr5323360ile.148.1622470026990; Mon, 31 May 2021 07:07:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622470026; cv=none; d=google.com; s=arc-20160816; b=hok8QEvpb8nR/WzVoPZkd11abKWhWLaQPpjMomwp2Ruz2++RvwtmuSqk3PzX7b0P2r D4qJy3VKbyEfySjEygNK8w5irQpvhi6VN5Ix8s1zexqblf4sNopdoESYL4Fv8RQpkZh+ +ISb2m2fSxp9rR6ejR/3ZLWJS3BmLz94hSkftormMZNvVTWkIG0Bh3gNEman4EoMwa32 eRBv5gCtXUT1ApL89jY6F2U6fI781pClEEAG98dakSjuAsMnZh17AJikhAcjwNA6e/MF qAkLTCMBBggCKSsxIAAZEq8E4Wnkxs4FCKL4RV6Op4NxwAH12hMVYHKiaqqzhKyRSuGE WV1A== 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=SXhZJ3ya9nIZn9mvHylZF+dzTwF6ZWN/5VU3gbSEx7Q=; b=bjdCp4AcI7/AfOT4LstQNanG29tyo10uq/d6MXs/aDLKEkP+AG7qawAcH/6sZ+kutH saFHwJJrSVg50KaMYeO++Dx8EtYI7h8owFU6tPj1ERwOMaaG4zZQmxWYYvCBp2N6wd02 wtw+TylQFQNBh+SdZ4iA65aK+pAa5FR25PMI/pXHmvU9wuy+y6DEyCpt4Ay8z2wt6/Fs 7F5rBS9U2m1ldwU7ROqo0/k4c+YjVEnjn7Lo7e6boN6/ZcSpGnFKmIjKpWgI+xaLPD2X L05RPe1ELIU91NXG+TF0l0X9Umt6zsJY4E/YCCHsow7HelY4zOiWyEn9UxX8YnpYjfvN cA8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0TJAW6X8; 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 x99si13489670jah.122.2021.05.31.07.06.53; Mon, 31 May 2021 07:07:06 -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=0TJAW6X8; 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 S232828AbhEaOH7 (ORCPT + 99 others); Mon, 31 May 2021 10:07:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:49452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbhEaNmz (ORCPT ); Mon, 31 May 2021 09:42:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1B9DB61474; Mon, 31 May 2021 13:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467718; bh=WCY1tsQHs0qPaWWClyBnYNlp7D6WjJ9ssswyl7No6Yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0TJAW6X8KbkQvargg1s0gMWZaQ3P0Fm4RtCixUeyeyi3zq/1gyOxC77NoYcCuo9Qd D76bLDgrIXP6hx/ee4SmM4A0Cz3YWNm2yRBChlJc0JS3K04poOrdsjOb1KcM9j+WtM nK2Yzm57QiSd3IL0zZ63lcSR9QI7anUnex2sBEwY= 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.14 55/79] media: gspca: properly check for errors in po1030_probe() Date: Mon, 31 May 2021 15:14:40 +0200 Message-Id: <20210531130637.763124921@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130636.002722319@linuxfoundation.org> References: <20210531130636.002722319@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 a0a90dd34ca8..a098aeb290c3 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