Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2669225pxj; Mon, 31 May 2021 07:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpZcJvUEv+MQ0852W/Umwgjkrx46kPoYL9PfUdT3k+DVFqxnqcIZAm1y+hrN1nmBsHv8Fp X-Received: by 2002:a17:907:7654:: with SMTP id kj20mr23518077ejc.439.1622472732471; Mon, 31 May 2021 07:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472732; cv=none; d=google.com; s=arc-20160816; b=0RitOxsEPb6Dys1s5ZzP33pQi6b+TkcWXtK6y5hUH4iIC0d15CQ94pZKaelCN+et47 UvxrLqgfnssTMR6N4ahoSVNbNHNXNWOV/iVBBcmYtoyJEvNY6sI1o67YehZpi3gU6Ea+ BjALImx3tl862c/52wImXfdPqEVgBBsyJR5aQ0XSIWc/4vY1GpOR3konR7dQuIaSm/64 D2BZZ7d8QAG0aoBMrz9bhSND8i6daeVD89X4uzmytNtxe0gLK+cDfC1QAYgJi53kf5M9 xH/1EAF1yO+5zr13lOICrcMRT9fu0dkxejRYeTDrzSZaZtU9i172bFTNOFmc6PNtWfYA PwgQ== 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=MFtT3jlauTm4GWUsdvOS+/MLuqRWXh/r4JoFClzKuSMa3CV9P/nfoegZZZf9/uF+K8 b0kPRfvqDscM9xZ/k8lK0Sqyivuy3hxmcyfO8z37KgO7u3uiibrRBrjTxi7tS7hgOvdw /63xWaZ9DPbVuRmvfHaDN/o6uPsjVvgFdrYWlMdwFn54suktM5LSojkRKDEyiPOzacFn T97iA6zyYykOG3VMJa73FA9oxjvYM6P9/f/iknDn5HI3TqeYCZvYi8gw8NRfkIqVn60W PyrV4vyK6P1R//+3xpHNRvJfzdEKRdg5VRyM7sH/eMlb6R6F6uxhicyBGmp8TpSgTkfN NddA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z9yv1IWS; 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 y12si923744eje.174.2021.05.31.07.51.49; Mon, 31 May 2021 07:52:12 -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=Z9yv1IWS; 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 S232698AbhEaOun (ORCPT + 99 others); Mon, 31 May 2021 10:50:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:37400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbhEaOB7 (ORCPT ); Mon, 31 May 2021 10:01:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CDB5861947; Mon, 31 May 2021 13:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468227; bh=/5mkWMxrniQRM0OIO+l/RFMqZzon2mnA8svi+4FOsBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z9yv1IWSTahLD9ZqSPpu/7vk4bZtlvaZ56T5k1lfI62uoUBn1TXvIzGBWWPctMIqR gozeqBettORYua6IBmuqXc9DEszGDRpfoVtzMKS1w0tb4UUDV+JzT4i01DQb8y27eB nBxcGOEc1IsD/dkWwir6tbjCo7r33Iwyj1uI30M8= 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.10 165/252] media: gspca: properly check for errors in po1030_probe() Date: Mon, 31 May 2021 15:13:50 +0200 Message-Id: <20210531130703.616876282@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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