Received: by 2002:a05:6512:2355:0:0:0:0 with SMTP id p21csp201895lfu; Wed, 30 Mar 2022 20:44:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZXYkooYTFXoNOukpbYszeY/fOFtBdm5dnf3/W0Rx8Xrnyfch+Qrg/ZIPRfJGsKeuY63eJ X-Received: by 2002:a17:902:d482:b0:154:6f46:a602 with SMTP id c2-20020a170902d48200b001546f46a602mr3244815plg.155.1648698259393; Wed, 30 Mar 2022 20:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648698259; cv=none; d=google.com; s=arc-20160816; b=ri89nKSc7FB+n/PqaDuJf004w+ne425pv/B1xrME8blXuZSyp+UlZNxE9o61Lqg4zs JzBPCPLxDjGJoJBFgsvfgbv56GeH0W945LtgEdGXdshfUCi9PtNu+isWnqgZc2Cr+7I7 Npbdn9Nzz6v+Jh+Po6mBNdpWJrCPeTS7pzqYt+kZFHo7Ti7w1vkpWQhSf5KLxDu0bfHF fiLdvX6jfXt0yUBplF5tImghCs413NHBDKYXZcWjRvPBoAy/B8tbNzHjYuQmh9AVoVGl xvO9peKIjF9Ck53ohyrlikMCODEivwF7k0YQa8JOdYu+wZiQyjCQvSr4nqm4HQr8fQgt fzTQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BPGuFhmbX6CB2MAVqrX8EQsyhE1cq3pRa1HZ9xRWvIs=; b=WqDfxXXm6sgWbiYLtC6xbsl8kpQ8OQuZBaFf/fIMEPpQfWBk+SHRevAfTvjIYydoYk 4uFuncH9bU5LAKXNdFVsP+OFbKUikJcbFT+ewbyWj7NM5Qh6lRwHlj7oR5iHK3mMxNfe IZMCXcO+FIQbg6bPkBAWfbRw8wf4p4rmzUBb66ESweqZ91wTtNrSfmdG731nj+ZywhNy 8lTlfmuDeEbHgKwl37tJliA5c9kVhHt+xsxsuUGxj9HsnIBNv3J+G4oUet4E1UHO8tF2 NUW54THI/G10ByF8HzdeR/eLWwWW6mJSb+hKzZ9eZt3oXURy/ueFWp3iVyvHVchfu8Aw jnXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GxIkpx/c"; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id cj12-20020a056a00298c00b004fa842a4794si20825568pfb.214.2022.03.30.20.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 20:44:19 -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=@kernel.org header.s=k20201202 header.b="GxIkpx/c"; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6621814A6D4; Wed, 30 Mar 2022 20:02:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244953AbiC3MBb (ORCPT + 99 others); Wed, 30 Mar 2022 08:01:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344851AbiC3Lxm (ORCPT ); Wed, 30 Mar 2022 07:53:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D91B126F909; Wed, 30 Mar 2022 04:49:47 -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 dfw.source.kernel.org (Postfix) with ESMTPS id DD52B61625; Wed, 30 Mar 2022 11:49:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E7BEC34111; Wed, 30 Mar 2022 11:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648640985; bh=qyc5E1VsAiEkog/l7n77XDh8NAl9OUtNeFvCzuC5lPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GxIkpx/cCphyp4nV3F9tMmg13W0Kn7I5US5XrXpLfnrFRmo+yVXDgBVQQ1XjMTrAN 4ffw0sJ1NTv9MmiqVztWo/uQF21wcwLZw3K6lkXGxlJIcvehFwJbZMt15zS0IuLIOo b8Y1n0GcbsFycepn9MSD/IhsIMnuwsG+oi/HVhPorOa8LQ8ZdeFdKxL3Nn5P9KusHO 6kMZrsCrfE0JniDIor7rT5cDkva6+bBm5v0DdkqvX5tib+xCaoy6/MdjTjLYCFEBUN ylhw2TZIBovY2vk/NMYzNComvBfmOs6bDYdJVggLX24yCQgtHrAV8I6LmD1pTyoPST 8zIzZHKYxWaSA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Paul Kocialkowski , Sakari Ailus , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 47/59] media: i2c: ov5648: Fix lockdep error Date: Wed, 30 Mar 2022 07:48:19 -0400 Message-Id: <20220330114831.1670235-47-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220330114831.1670235-1-sashal@kernel.org> References: <20220330114831.1670235-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 947d437ed0ef..01e22c535267 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