Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp605023pxb; Tue, 5 Apr 2022 15:42:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaag0CEfzQNaTLAdik9mbC3ljhAOTekDHNqQlCm4NWYGdZGwMl7pbdiAQg1RPsDCAWKjEf X-Received: by 2002:a17:90b:1b10:b0:1c9:cf93:c57 with SMTP id nu16-20020a17090b1b1000b001c9cf930c57mr6443377pjb.154.1649198535710; Tue, 05 Apr 2022 15:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649198535; cv=none; d=google.com; s=arc-20160816; b=QB5PwukMH44aFrFd8YZ572DkQN4Nu231eduJM6Ds5v2Tzh23Xyz7tyFXWysLQG5wru 2PShVS16tZVAYxyfvv7FsuZtRZ+e5irnQehFbSKwqd2tMRhztIdY8X8fvaJJ4NX20VWm b1GxmR/402rkwBpnICtPitmfwyXDwC36OFRgP7b+4ZsmV+a75LtIXdT67prwLxjoJH// mQIkNHHJnBFLLYWdbwQ33klgYvpX/PHi8V1wn9CtXWMuaL3EnPwh+SYEW+DsP2RuvB4j bH7yr48Yj7TEaJCJH994q3HnbI893o7RbylSvCayqOpy9SplisLYn4YEyl4peODIN1Y4 slOw== 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=zaf7Niefzi99Tc6xl6Rn7LHJl+JipyJAZ5bC6t9GCoo=; b=aEP0uHI0tkMFudyIejIgYeIAoy0osyvefmdcyNMdUzTUoBmznlf2XXvbAVBNXt7wpf lvVjAJBALhVL161HHYQLxyxQ9gwemr35zdgk0zfAMM2kBA4fpjBViEiJK8eg9CsmNfMo SSW8lNdgiJSYqa/2oJXDNokKDUp+OEorwdchL9nO/JNIyuk3MRYm46wm2m6BTWPjBkkO egyrPW1B92xBK1j2kqvF1l39CvBjDcgMtjHMQaThHx4zlbH+9fqPGlEmcGdSxwMbQ++U zGIqcIMmHpctZ/ZRsZSBE/D6+qBvouiTFOlUBZOa6GzO802W/gx0WWaHpa8k50Kmz3wJ rh7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lc9NVrLT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k198-20020a636fcf000000b00385d8719515si13967240pgc.570.2022.04.05.15.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:42:15 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lc9NVrLT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4AD1036693; Tue, 5 Apr 2022 15:23:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351606AbiDEN2n (ORCPT + 99 others); Tue, 5 Apr 2022 09:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345250AbiDEJWX (ORCPT ); Tue, 5 Apr 2022 05:22:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0365C3A5D6; Tue, 5 Apr 2022 02:09:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A3EEB81A12; Tue, 5 Apr 2022 09:09:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7A71C385A2; Tue, 5 Apr 2022 09:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149796; bh=zUUeeZnaMW+gV0tRTgNtHUinIBWwkI9x7zikir/8Uio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lc9NVrLTtuj9ezocEIGuAL1zYsPgPDBwPpeXSlWCZ+WpWSTpf24UE21Y8ZF6rr9/0 qEikGG0Wcaa0LW3BshOhkb2bM3MBXdLQ945zPRP9W4rro0dFwkilr0RA9SYV8ViE/P Zf27xG1gKStZMG033/Wm5uC50vIpuC5etJc/cCQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Kocialkowski , Hans de Goede , Sakari Ailus , Sasha Levin Subject: [PATCH 5.16 0845/1017] media: i2c: ov5648: Fix lockdep error Date: Tue, 5 Apr 2022 09:29:18 +0200 Message-Id: <20220405070419.322347426@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit d4cb5d3c4cee28aa89b02bc33d930a6cf75e7f79 ] ov5648_state_init() calls ov5648_state_mipi_configure() which uses __v4l2_ctrl_s_ctrl[_int64](). This means that sensor->mutex (which is also sensor->ctrls.handler.lock) must be locked before calling ov5648_state_init(). ov5648_state_mipi_configure() is also used in other places where the lock is already held so it cannot be changed itself. Note this is based on an identical (tested) fix for the ov8865 driver, this has only been compile-tested. Cc: Paul Kocialkowski Reviewed-by: Paul Kocialkowski Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Sasha Levin --- drivers/media/i2c/ov5648.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c index 78040f0ac02f..ef8b52dc9401 100644 --- a/drivers/media/i2c/ov5648.c +++ b/drivers/media/i2c/ov5648.c @@ -1778,8 +1778,14 @@ static int ov5648_state_configure(struct ov5648_sensor *sensor, static int ov5648_state_init(struct ov5648_sensor *sensor) { - return ov5648_state_configure(sensor, &ov5648_modes[0], - ov5648_mbus_codes[0]); + int ret; + + mutex_lock(&sensor->mutex); + ret = ov5648_state_configure(sensor, &ov5648_modes[0], + ov5648_mbus_codes[0]); + mutex_unlock(&sensor->mutex); + + return ret; } /* Sensor Base */ -- 2.34.1