From patchwork Mon Mar 24 13:01:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 14027215 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50FC925EFBE for ; Mon, 24 Mar 2025 13:01:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742821282; cv=none; b=RuPwHIK62+LhXqhoevGqbbtnIG8cE60fe+7ZaiLq6ZG1hgD/8aELj0sEHovAy4k7P5OoY4JjjqU+3ktCWxs29FaAiFT34PIKx+l8mynRQs4dRRAQ4THVk59S8rg1m5pcA1Awt/MFxwelTrOPJqTODMVu94mumiIc6GhC0IL52rI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742821282; c=relaxed/simple; bh=Du8dujwJxtsLJWrsIYIMgP23o+fvBwsT6i7zJcLV1Ik=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rUNS+0emMH9PCP+9SkfIA0SekweQS3o2ooH7JAJXD6jNEOLoaSf9L+XvnJC0jERd74oJciFbHTcgODmqMmH/EXOIdMQ6+XuoT1iNqrzh9HJhqoNe1RpCSC6vqjTJ4a1DTCKpbgFZ9gzTMrfjYJSYitHI3zByBm06WzWVfmnYiFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=IKp4u+bQ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IKp4u+bQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742821279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GvRk4VemhZP7rDwfgDJ18VhbnuimZF/4Wl4fbRihXpY=; b=IKp4u+bQVxSsQqaKHGXYvn8Nu20JUcWXs3Tiqhgpci1tpI1uNjgl5iJ9QgOrAvqCM8+NZW 4575YB2CpnyLZntgw7zw+Wf4LVnQxdCqANvW+x44mEriKvHe3HE4BUkr61gpGIKPr8fExV Q2kK06OWHb3pIQH/pK0TVaFhuQThhZ4= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-ellKYf5WNCCIRE8SIcewhA-1; Mon, 24 Mar 2025 09:01:15 -0400 X-MC-Unique: ellKYf5WNCCIRE8SIcewhA-1 X-Mimecast-MFC-AGG-ID: ellKYf5WNCCIRE8SIcewhA_1742821274 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 75BC918EBE91; Mon, 24 Mar 2025 13:01:14 +0000 (UTC) Received: from x1.redhat.com (unknown [10.44.33.69]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1423719373C4; Mon, 24 Mar 2025 13:01:10 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Tianshu Qiu , Bingbu Cao Cc: Hans de Goede , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH] media: ov2740: Move pm-runtime cleanup on probe-errors to proper place Date: Mon, 24 Mar 2025 14:01:09 +0100 Message-ID: <20250324130109.375068-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 When v4l2_subdev_init_finalize() fails no changes have been made to the runtime-pm device state yet, so the probe_error_media_entity_cleanup rollback path should not touch the runtime-pm device state. Instead this should be done from the probe_error_v4l2_subdev_cleanup rollback path. Note the pm_runtime_xxx() calls are put above the v4l2_subdev_cleanup() call to have the reverse call order of probe(). Signed-off-by: Hans de Goede Reviewed-by: Bingbu Cao --- drivers/media/i2c/ov2740.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index 80d151e8ae29..6cf461e3373c 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -1456,12 +1456,12 @@ static int ov2740_probe(struct i2c_client *client) return 0; probe_error_v4l2_subdev_cleanup: + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); v4l2_subdev_cleanup(&ov2740->sd); probe_error_media_entity_cleanup: media_entity_cleanup(&ov2740->sd.entity); - pm_runtime_disable(&client->dev); - pm_runtime_set_suspended(&client->dev); probe_error_v4l2_ctrl_handler_free: v4l2_ctrl_handler_free(ov2740->sd.ctrl_handler);