Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6928139ybn; Mon, 30 Sep 2019 06:07:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqCFRhuKBX+jx8u4wCv6XmyjgsjpVzuY5hOdDV5QSjElU2rAsNlQGoy6+0Q7eBa+fwIUX5 X-Received: by 2002:a50:a7c4:: with SMTP id i62mr19191341edc.92.1569848877790; Mon, 30 Sep 2019 06:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569848877; cv=none; d=google.com; s=arc-20160816; b=KcaufJ5KaAgo+STHHxRbuNhFASS/ROyzHXTo+BaMTz5zpCujmxNPMeATvlZ+AvSPWX 9hVR83TS1Jvdnk+QDlqjVKXsU1MLlONV2Zvq7+MfjyY92/m59UNDNmtum/544sVTfdef H1VE8SMOUBQNE+ql5njEfhHTQrhq/9IFP2+LstEivLHJkkVrQKUAB7YOj9F857cq826I snywHw6HhO8OFej+z5m3eZGEMcOexzY4dRSiNuJi5fSNbDu+GqJz7PUrzsaz2jVq2kkv zF4ALHut60DjknM4KTYihvZ4dBGkc7eJKLgx49ysE/NTNf8Oapyx+U4fn3hCS/TkiMfs V+og== 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=Xr4HzhjJUkeC5JJjlQ95EiC6/pbo6PahDZ4riJBggtk=; b=caEHGfGLVk8bJuPYtOG5EuiHKhJqyHnS5UiQ+f84mMB4WxdQtsPQwAN540wJJixW4Y lffo9JlxYuVIh8vFsQ3Zp23jB72NrxJHEHEDNdrZk7FONfhZ8EWGHMeqZ5sAj/tnIsxf QwmdMX1I1esifzI+js2MrSNlqkt4vfWqp9rwGa/JJAO3VmLqLxJ/aC7ya4d3KRKAhSqx ncb+HLLTEi3NqajcdozInjiAQerRoYWN0aL86R5+rxfRG10mKo0Velbl1kknhNBidGTo XYzWT9AMNs0zhR5cNJ7sxWtZOQuPHFi/AW4KiIIWcl4YzrZcScBY2tPXLPLKzttF7gXK kDLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ePIF9i8B; 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 y54si7572805edb.217.2019.09.30.06.07.32; Mon, 30 Sep 2019 06:07:57 -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=ePIF9i8B; 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 S1731293AbfI3NEt (ORCPT + 99 others); Mon, 30 Sep 2019 09:04:49 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:46414 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731233AbfI3NEo (ORCPT ); Mon, 30 Sep 2019 09:04:44 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8UD4cFB110324; Mon, 30 Sep 2019 08:04:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569848678; bh=Xr4HzhjJUkeC5JJjlQ95EiC6/pbo6PahDZ4riJBggtk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ePIF9i8Bihsex48yuU/TfyJVX1tAuTUjrzw1jj7vX4NvefKpexCruG0ria2HSXSKX 0CRIofmT/IzRoe28DqZgLxTOV1pMoQdTKLtZ3uNppum4+0/78UY6X5WO/zdKIRzTXv BC9LmrnaIUaujT9/eQQD7bNbfVv4vjiKntwlIFWU= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8UD4cZI057422; Mon, 30 Sep 2019 08:04:38 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) 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; Mon, 30 Sep 2019 08:04:28 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE111.ent.ti.com (157.170.170.22) 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; Mon, 30 Sep 2019 08:04:28 -0500 Received: from uda0869644b.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8UD4Zih115624; Mon, 30 Sep 2019 08:04:38 -0500 From: Benoit Parrot To: Hans Verkuil , Sakari Ailus CC: , , , Benoit Parrot , Jyri Sarha Subject: [Patch v5 2/8] media: i2c: ov2659: Fix sensor detection to actually fail when device is not present Date: Mon, 30 Sep 2019 08:06:38 -0500 Message-ID: <20190930130644.8704-3-bparrot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190930130644.8704-1-bparrot@ti.com> References: <20190930130644.8704-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 Acked-by: Lad, Prabhakar --- 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