Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3815615ybn; Fri, 27 Sep 2019 11:47:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqznndfpyTU1pZBKHhmKtLnBKuvGwZbOFj6nhdQg84Qxbkz1J8mz5LVxnkWOVv2IlZIv407d X-Received: by 2002:a05:6402:1ade:: with SMTP id ba30mr6316501edb.304.1569610044333; Fri, 27 Sep 2019 11:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569610044; cv=none; d=google.com; s=arc-20160816; b=k4xxCAMGPfOUxDiGCClunNx0gxAdsRVjuk0hUE9H0ft8BEO4UpN4eDEDo/IGOwJ50l E4HSUJ4kOZS6DjaUXxlS2VNn415AAaj/B19WCbeB5z7i+lLSriZK/FYfeKbuS/nI+tda qFfKhKt1yGd9Yzr+ZYKgNqMkywNr8mmfcoZPucuW5OLk7iiXMAozvEG4IjhDbIVnbec8 a9n4zcbCel/A0K2IOzXlDiIGFVGk8ySjMAHw5kVxbNGpQZQhgpegL/dKMas4oFx5bs7p C/rjT8dFCEKIx5d9zXaDj1nDvIqvDzDBvDY/P7MK6tcpXbC6bPZNivgTMNrGQK1Alnza caPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=CrlXIhfT8xsTDmUmEr9Vo9usJitecelkTp/ShJS5Jrc=; b=gG71+VcvuGdDvBihioo7BPLc28W/uR1ivJYdUhmHy5MOoDvBs+bW+Nd/IZrFDTnfu5 jI1oJDcbwdAX1eTCpLaHJBKyTyRHrD9Yt4B+JfmK1V076Kjcc0Q4V5H8mhMsBccdM2sC /ZAs7r/DunjqJP6Lk+gdMHb8Mpl5So7etboAwhPrbs3WaKqUBxLVThvbQKr3gd0rIq2t iJq+cBVHl8ANwIzDBEcnhuZO4guxdqesSV7Jmn1AkRh8ibZo+tQ1GkR8xHQSW0pVKy12 6CHs6Ty++HGK6fUuef05JSiu3fls1VOiGH/Dh9dhe/Byh7daMTVIjtht4J9tP9sO3eEd JhkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cfWbJsWH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m22si3116112ejr.368.2019.09.27.11.46.59; Fri, 27 Sep 2019 11:47:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cfWbJsWH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728490AbfI0SpU (ORCPT + 99 others); Fri, 27 Sep 2019 14:45:20 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:46734 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbfI0SpS (ORCPT ); Fri, 27 Sep 2019 14:45:18 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8RIjHMk094629; Fri, 27 Sep 2019 13:45:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569609917; bh=CrlXIhfT8xsTDmUmEr9Vo9usJitecelkTp/ShJS5Jrc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cfWbJsWH3jTMGMExD1e//p+mdipMd0efinzI8/GCKXGr2IfLDPNw3vFW2LtHl0v7B O2jEyFw1N06Z2JVTzboYzsFC8z/imz49yLArznk+3q7hIW+a6szDsCJ68xvgqNNGld JrvT2Na+/YodeTRlYUXQUTHIrGpKHYp4BTjHKH8k= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8RIjHBP122200; Fri, 27 Sep 2019 13:45:17 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 27 Sep 2019 13:45:16 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 27 Sep 2019 13:45:08 -0500 Received: from uda0869644b.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8RIjEVX122194; Fri, 27 Sep 2019 13:45:16 -0500 From: Benoit Parrot To: Hans Verkuil , Sakari Ailus CC: , , , Benoit Parrot , Jyri Sarha Subject: [Patch v4 2/8] media: i2c: ov2659: Fix sensor detection to actually fail when device is not present Date: Fri, 27 Sep 2019 13:47:16 -0500 Message-ID: <20190927184722.31989-3-bparrot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190927184722.31989-1-bparrot@ti.com> References: <20190927184722.31989-1-bparrot@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure that if the expected sensor device id register is not recognized properly the failure is propagated up so devices are not left partially initialized. Signed-off-by: Benoit Parrot Signed-off-by: Jyri Sarha --- drivers/media/i2c/ov2659.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c index 17573257097d..efbe6dc720e2 100644 --- a/drivers/media/i2c/ov2659.c +++ b/drivers/media/i2c/ov2659.c @@ -1330,11 +1330,12 @@ static int ov2659_detect(struct v4l2_subdev *sd) unsigned short id; id = OV265X_ID(pid, ver); - if (id != OV2659_ID) + if (id != OV2659_ID) { dev_err(&client->dev, "Sensor detection failed (%04X, %d)\n", id, ret); - else { + ret = -ENODEV; + } else { dev_info(&client->dev, "Found OV%04X sensor\n", id); ret = ov2659_init(sd, 0); } -- 2.17.1