Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2706943pxj; Mon, 31 May 2021 08:43:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+ZvQcon36m4Y03p7APN77ZXsatSgHnSJ91TuYX80of8pFfczLObrQneRRH8Edljq/bm9l X-Received: by 2002:a05:6402:40c:: with SMTP id q12mr25817657edv.0.1622475832539; Mon, 31 May 2021 08:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622475832; cv=none; d=google.com; s=arc-20160816; b=0AJeOVBI6edivRBQBSdxlMwzV9C7jdzS6QZk3uX+yvp+UwShDw7+jJbvY5jT+S4oOX wgpv4rjBGfHCgVyZ0e//U1lADGtQv6SFiJ+A75Xr6yyNJJeZ3YIidQghOK9mYWPctfLF 7yGl7izFCPaOP/CMtgs9FwqwKKk1v7zeFQuU2q206oFDWnU7x/nab1GKJk2PsO4w3ddN uY5xbMTB1I0+YwiXR+TSa9hfLtXHP+C7Mqn9quNUPpbheVYkGRzC82DMrJ1jAOdkp5Qn DlNH1ZsZdR5GLBYBUMUtdSH49vs2po4q3qXivaF6zRlXp4vcoU1W13q2mpdXFxqf3E4x CcnQ== 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=WquBxH/VX1mhZjOsbxjFec+NGigle4fTBcRlXHIyJvWjWgareM9GWcnL0a+PEC3JFC EKxJ93iWsU0LZSdby9+E79LC8S9HHOxU6ZgKbiQR6hSaDPgnL2p5wwkUTHerBqlQl91E qXSbcpVs4cRxFeLu7Qgmxrf818xxphh74RAj2nEMt29G39HtcA7cCaJASFA3q8TzRKlh ZgseSkHE+EQqhjgP7gTTtuHMaWhjr0T7a0OA3xrygWIqGuaGpde6W+8mvlVv070S7yJq BedzdeLCLw1fH23clPSLlVYU7H2JCn1+6Z/oun1RS6rSNVZIcU25AxWlIXJoo24t7OxA GHqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SOL+Ddib; 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 k1si8573581ejg.69.2021.05.31.08.43.28; Mon, 31 May 2021 08:43:52 -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=SOL+Ddib; 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 S233619AbhEaPmh (ORCPT + 99 others); Mon, 31 May 2021 11:42:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:48842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233471AbhEaOXd (ORCPT ); Mon, 31 May 2021 10:23:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 761096142B; Mon, 31 May 2021 13:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468765; bh=/5mkWMxrniQRM0OIO+l/RFMqZzon2mnA8svi+4FOsBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SOL+Ddib1iTIxUYoGGvg/YJA5W2UBcoGK2abXek/z9SUePtvdQUJHwhNCmdUPBDck gy9wDy66yCugwHmLt4TT5BdLz0r1J15WCvtfjevUBnADHKioETu+QPD7EQhOfX/lOC +kCRaK1j1a1cDtrNmj0/Vn3hprKevnu9ZS4hC2XA= 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.4 118/177] media: gspca: properly check for errors in po1030_probe() Date: Mon, 31 May 2021 15:14:35 +0200 Message-Id: <20210531130651.999465163@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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