From patchwork Thu Dec 19 19:27:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13915579 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 55E661AE875 for ; Thu, 19 Dec 2024 19:27:39 +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=1734636461; cv=none; b=cUa4zdx8nbTTNt3dn1Lnwf/umJ3vFnzSfjAVarHH0d00jVWOMwX4DTt/RNUY3J4WYcTevIbMMb8sEKfQvWLuHweJYmt85C40VgQXX1U6thhLD/eZewmShOq/sRvRflv1r5odRPlCPotared+HpOCffZGX3OHU7qj9oi82KtzzRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734636461; c=relaxed/simple; bh=Efeih0sE+iZmXFH+maxzPA8OiWpE3105c8vH2/eXKtc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RtMafUIjXibPKz9gPoEilbS3ACEb9nhubVxNB87AvO2N95ot/4WTLvE6/v70cUGsV7OfdCc4RsUPIASoO8MnNtAUgq7YhGGOFdO3134G35MGBfQefQTKJ+5n1NML0DAz/pGA1AskcO49D8zWqmA+g0vrIIYdnDXslA4wXBELn8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=Mfc7g5XU; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="Mfc7g5XU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734636458; 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=QSpGyY51F9Z3FnymB5FSOHcZmc33S1pPzw4xTvYvSPg=; b=Mfc7g5XUBTpqLyKdJZFxMseh3KjvdUqdjd/IP38BRBoOBqLktfmdHXvT/M4BCB6v0iPR8H YMaSXP1hHFTu3ZCIXbV0iz2wHZ0OuiYyPivWcpEtkOFRYbIn5F3lyzqLRN/QuLCM8k3qO4 hFdqYI8d3RdNrcPuGDo40BX9tbpuESI= Received: from mx-prod-mc-05.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-500-MbSwbpvHNeCU6Vugb9uTFg-1; Thu, 19 Dec 2024 14:27:37 -0500 X-MC-Unique: MbSwbpvHNeCU6Vugb9uTFg-1 X-Mimecast-MFC-AGG-ID: MbSwbpvHNeCU6Vugb9uTFg Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EA5E11956048; Thu, 19 Dec 2024 19:27:35 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.194.60]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EFB81956096; Thu, 19 Dec 2024 19:27:34 +0000 (UTC) From: Hans de Goede To: Sakari Ailus Cc: Hans de Goede , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 1/4] media: hi556: Fix memory leak (on error) in hi556_check_hwcfg() Date: Thu, 19 Dec 2024 20:27:30 +0100 Message-ID: <20241219192733.45659-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.15 Commit 7d968b5badfc ("media: hi556: Return -EPROBE_DEFER if no endpoint is found") moved the v4l2_fwnode_endpoint_alloc_parse() call in hi556_check_hwcfg() up, but it did not make the error-exit paths between the old and new call-site use "goto check_hwcfg_error;" to free the bus_cfg on errors. Add the missing "goto check_hwcfg_error;" statements to fix a memleak on early error-exits from hi556_check_hwcfg(). Fixes: 7d968b5badfc ("media: hi556: Return -EPROBE_DEFER if no endpoint is found") Signed-off-by: Hans de Goede --- drivers/media/i2c/hi556.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c index 3ac42d1ab8b4..c28eca2f86f6 100644 --- a/drivers/media/i2c/hi556.c +++ b/drivers/media/i2c/hi556.c @@ -1230,12 +1230,13 @@ static int hi556_check_hwcfg(struct device *dev) ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk); if (ret) { dev_err(dev, "can't get clock frequency"); - return ret; + goto check_hwcfg_error; } if (mclk != HI556_MCLK) { dev_err(dev, "external clock %d is not supported", mclk); - return -EINVAL; + ret = -EINVAL; + goto check_hwcfg_error; } if (bus_cfg.bus.mipi_csi2.num_data_lanes != 2) { From patchwork Thu Dec 19 19:27:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13915581 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 0C55F1AE875 for ; Thu, 19 Dec 2024 19:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734636464; cv=none; b=SbpkvQLYCfN3X61+WD8gVXazF0wjwGQstw1eugdk/VW8aY8yB7KTfI2S5v2ZoBSR3ObPxrkgSObRRQV4rZcfGWweOE47JuFWqT/oj9cEGboIRFKnxbi9SKX+rqlVhq3IeRSmOTWCGTfkRsuRFubkI8suwDB5vq2ODAJy5HqAyqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734636464; c=relaxed/simple; bh=rhSCqziON7+14u7OBaNNV9k7+fErnAmk6BFRL8cXoaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CDKkxwN2GVU6ZsmWOCbHXdi47qEQXh7O4ZaslBAvp4l0xzh7Y2BEAQNNa7bWDmda1mocgkdw43a8faIi9BNWegqNyJmT67jo/dXC3zcdPzYdpVi+FlEk0w3tRXndtvnZhdJrfMJuhIp5biqZ0jx3u4NLSUk6LU6Qxu5VqWfPHDI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=XNfumc/c; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="XNfumc/c" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734636461; 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: in-reply-to:in-reply-to:references:references; bh=VRw238MAW+UJfIy6g6dnCMsFwkQucdw9S+CCRP7i5d4=; b=XNfumc/cBafXBU9eMAEH5CnS+ulAK6Z02stiLW7rWUYW6EsudoVl/8XERmvoCMVby5IHhj HuTecIOYfUYaODJkkvnQDN8gAy3EQyZ9nQ8Bt9t+BKRhhpFCSHOul6QK6fqdBxeLrNuH1Q 9rolRKBiIZtfoFa0FPFuOhl50d15WRg= Received: from mx-prod-mc-03.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-617-46roa5vcNrCesGDLcoKHqA-1; Thu, 19 Dec 2024 14:27:38 -0500 X-MC-Unique: 46roa5vcNrCesGDLcoKHqA-1 X-Mimecast-MFC-AGG-ID: 46roa5vcNrCesGDLcoKHqA Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AA75B19560B3; Thu, 19 Dec 2024 19:27:37 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.194.60]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3CB37195608A; Thu, 19 Dec 2024 19:27:36 +0000 (UTC) From: Hans de Goede To: Sakari Ailus Cc: Hans de Goede , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 2/4] media: hi556: Add missing '\n' to hi556 error messages Date: Thu, 19 Dec 2024 20:27:31 +0100 Message-ID: <20241219192733.45659-2-hdegoede@redhat.com> In-Reply-To: <20241219192733.45659-1-hdegoede@redhat.com> References: <20241219192733.45659-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.15 Many hi556 dev_err() error messages miss a terminating '\n', add the missing '\n' to these. Signed-off-by: Hans de Goede --- drivers/media/i2c/hi556.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c index c28eca2f86f6..960d6c2d3d93 100644 --- a/drivers/media/i2c/hi556.c +++ b/drivers/media/i2c/hi556.c @@ -719,7 +719,7 @@ static int hi556_write_reg_list(struct hi556 *hi556, r_list->regs[i].val); if (ret) { dev_err_ratelimited(&client->dev, - "failed to write reg 0x%4.4x. error = %d", + "failed to write reg 0x%4.4x. error = %d\n", r_list->regs[i].address, ret); return ret; } @@ -926,7 +926,7 @@ static int hi556_identify_module(struct hi556 *hi556) return ret; if (val != HI556_CHIP_ID) { - dev_err(&client->dev, "chip id mismatch: %x!=%x", + dev_err(&client->dev, "chip id mismatch: %x!=%x\n", HI556_CHIP_ID, val); return -ENXIO; } @@ -1002,14 +1002,14 @@ static int hi556_start_streaming(struct hi556 *hi556) reg_list = &link_freq_configs[link_freq_index].reg_list; ret = hi556_write_reg_list(hi556, reg_list); if (ret) { - dev_err(&client->dev, "failed to set plls"); + dev_err(&client->dev, "failed to set plls\n"); return ret; } reg_list = &hi556->cur_mode->reg_list; ret = hi556_write_reg_list(hi556, reg_list); if (ret) { - dev_err(&client->dev, "failed to set mode"); + dev_err(&client->dev, "failed to set mode\n"); return ret; } @@ -1021,7 +1021,7 @@ static int hi556_start_streaming(struct hi556 *hi556) HI556_REG_VALUE_16BIT, HI556_MODE_STREAMING); if (ret) { - dev_err(&client->dev, "failed to set stream"); + dev_err(&client->dev, "failed to set stream\n"); return ret; } @@ -1034,7 +1034,7 @@ static void hi556_stop_streaming(struct hi556 *hi556) if (hi556_write_reg(hi556, HI556_REG_MODE_SELECT, HI556_REG_VALUE_16BIT, HI556_MODE_STANDBY)) - dev_err(&client->dev, "failed to set stream"); + dev_err(&client->dev, "failed to set stream\n"); } static int hi556_set_stream(struct v4l2_subdev *sd, int enable) @@ -1229,25 +1229,25 @@ static int hi556_check_hwcfg(struct device *dev) ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk); if (ret) { - dev_err(dev, "can't get clock frequency"); + dev_err(dev, "can't get clock frequency\n"); goto check_hwcfg_error; } if (mclk != HI556_MCLK) { - dev_err(dev, "external clock %d is not supported", mclk); + dev_err(dev, "external clock %d is not supported\n", mclk); ret = -EINVAL; goto check_hwcfg_error; } if (bus_cfg.bus.mipi_csi2.num_data_lanes != 2) { - dev_err(dev, "number of CSI2 data lanes %d is not supported", + dev_err(dev, "number of CSI2 data lanes %d is not supported\n", bus_cfg.bus.mipi_csi2.num_data_lanes); ret = -EINVAL; goto check_hwcfg_error; } if (!bus_cfg.nr_of_link_frequencies) { - dev_err(dev, "no link frequencies defined"); + dev_err(dev, "no link frequencies defined\n"); ret = -EINVAL; goto check_hwcfg_error; } @@ -1260,7 +1260,7 @@ static int hi556_check_hwcfg(struct device *dev) } if (j == bus_cfg.nr_of_link_frequencies) { - dev_err(dev, "no link frequency %lld supported", + dev_err(dev, "no link frequency %lld supported\n", link_freq_menu_items[i]); ret = -EINVAL; goto check_hwcfg_error; @@ -1334,7 +1334,7 @@ static int hi556_probe(struct i2c_client *client) ret = hi556_check_hwcfg(&client->dev); if (ret) { - dev_err(&client->dev, "failed to check HW configuration: %d", + dev_err(&client->dev, "failed to check HW configuration: %d\n", ret); return ret; } @@ -1372,7 +1372,7 @@ static int hi556_probe(struct i2c_client *client) ret = hi556_identify_module(hi556); if (ret) { - dev_err(&client->dev, "failed to find sensor: %d", ret); + dev_err(&client->dev, "failed to find sensor: %d\n", ret); goto probe_error_power_off; } } @@ -1381,7 +1381,7 @@ static int hi556_probe(struct i2c_client *client) hi556->cur_mode = &supported_modes[0]; ret = hi556_init_controls(hi556); if (ret) { - dev_err(&client->dev, "failed to init controls: %d", ret); + dev_err(&client->dev, "failed to init controls: %d\n", ret); goto probe_error_v4l2_ctrl_handler_free; } @@ -1392,13 +1392,13 @@ static int hi556_probe(struct i2c_client *client) hi556->pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&hi556->sd.entity, 1, &hi556->pad); if (ret) { - dev_err(&client->dev, "failed to init entity pads: %d", ret); + dev_err(&client->dev, "failed to init entity pads: %d\n", ret); goto probe_error_v4l2_ctrl_handler_free; } ret = v4l2_async_register_subdev_sensor(&hi556->sd); if (ret < 0) { - dev_err(&client->dev, "failed to register V4L2 subdev: %d", + dev_err(&client->dev, "failed to register V4L2 subdev: %d\n", ret); goto probe_error_media_entity_cleanup; } From patchwork Thu Dec 19 19:27:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13915580 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 0C5B11B0F10 for ; Thu, 19 Dec 2024 19:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734636464; cv=none; b=tOCEjV3wV8BI/GtygFP/C3RqZ8WWQDcWwOjNCnxtETG4t8Re1Yt9KFgUWQYM3IqcQJFsyHRCTWoMuLMhLToxuigAVIOnjGIUyA7YbDEndSs+4YOfhe2M4C6Wgx99FMnxHok17YcaeGKDzOTtAhohlqwSrJlapXAC7LlqQ78tSvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734636464; c=relaxed/simple; bh=RRhXT53WdyqN5PHui15rZqwk/Ea6k0LtYjgaIhcMTKo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UaoBFEAHUAZ/N+oB5kJyue98jIJpe1g1uDLOmcQSLpzt9eP8i4LPQS8lVi/E6wIxVQ/WLV7ZOIH9ffCP0DkeUdNADhotKN0/EboI3G89HMfhWpDGtDw18km1sbBFTO0Uoy5ZOI7jHWfXQ142stE2q39v+ga6NHKYgrTLONkYTLM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=NRdWH+X/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="NRdWH+X/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734636462; 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: in-reply-to:in-reply-to:references:references; bh=pUgi1yprzLXPaQaoeAw6aHK4O42KHYqsgX4NML0YkQs=; b=NRdWH+X/TC/OR7w55pXSnAuoUgTosqLt4r9Y0DAGjHf3kh/3Mv2HrtYS3v+dtIAdoTbrQm UzjRcpZL6QbMBmeMD7gIRB+sAGjkwYOTQmB73jA015yQMcOFvmwt7B40DTSjOMTozFZPuN R0wrkK0XjQuUKZwiT1cypdJcbU6OpLI= 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-615-D5cm8sfFNKauYatBcVM_qw-1; Thu, 19 Dec 2024 14:27:40 -0500 X-MC-Unique: D5cm8sfFNKauYatBcVM_qw-1 X-Mimecast-MFC-AGG-ID: D5cm8sfFNKauYatBcVM_qw Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 9A71019560AB; Thu, 19 Dec 2024 19:27:39 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.194.60]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 440F7195608A; Thu, 19 Dec 2024 19:27:37 +0000 (UTC) From: Hans de Goede To: Sakari Ailus Cc: Hans de Goede , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 3/4] media: hi556: Improve error logging when fwnode is not found Date: Thu, 19 Dec 2024 20:27:32 +0100 Message-ID: <20241219192733.45659-3-hdegoede@redhat.com> In-Reply-To: <20241219192733.45659-1-hdegoede@redhat.com> References: <20241219192733.45659-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.15 The hi556 driver waits for the endpoint fwnode to show up in case this fwnode is created by a bridge-driver. It does this by returning -EPROBE_DEFER, but it does not use dev_err_probe() so no reason for deferring gets registered. After 30 seconds the kernel logs a warning that the probe is still deferred, which looks like this: [ 33.952052] i2c i2c-INT3537:00: deferred probe pending: (reason unknown) Use dev_err_probe() when returning -EPROBE_DEFER to register the probe deferral reason changing the error to: deferred probe pending: waiting for fwnode graph endpoint Signed-off-by: Hans de Goede --- drivers/media/i2c/hi556.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c index 960d6c2d3d93..57c51d0e9c4e 100644 --- a/drivers/media/i2c/hi556.c +++ b/drivers/media/i2c/hi556.c @@ -1220,7 +1220,8 @@ static int hi556_check_hwcfg(struct device *dev) */ ep = fwnode_graph_get_next_endpoint(fwnode, NULL); if (!ep) - return -EPROBE_DEFER; + return dev_err_probe(dev, -EPROBE_DEFER, + "waiting for fwnode graph endpoint\n"); ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg); fwnode_handle_put(ep); From patchwork Thu Dec 19 19:27:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13915582 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 9703E1AAA0D for ; Thu, 19 Dec 2024 19:27:46 +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=1734636468; cv=none; b=caKJDu1IhaM/S0Anfrb/aqxVIq3AhowHoHHHFv5W70d/wVFuxdRvDrNuUWGxlbi8koKtQXRq9epfkOXaq1dIhtcJ5oiQ3Eyp882qcvAo4rRcUvan1QyHsUj0+tP5Etsq/emCaSBLnqFDt+I4hia+81fdLhol8G67k+oVxF/YTsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734636468; c=relaxed/simple; bh=PBG14hg0sWDIRS+jtzh3sHSuXsS4dCOf11Hlwm+zvxU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m9eTChD4bixOU/lQ6xOlKiwTT6ckFVIC2/P1rBuMapHudS27jqFeNO8xVLGPuwSPuFftUBzKSKjV9tpl739l7lJ8ihr81NxnyJPgpdorBc+lgNjrTrX8NMSBpwrG98obWP2Dox7SSWWHYbdKyS7eT0+QlgedHHfjd6zTUKTQqPg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=Dd/XOevT; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="Dd/XOevT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734636465; 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: in-reply-to:in-reply-to:references:references; bh=heDsUvY2themo17pphCDVW4owjAYMa0e97gtkFz1I5I=; b=Dd/XOevTccm9WR2dZyGTxnAd+PFsgry7BK3IzbgPRxpz/ruU3SHVxwxbdUR6bdNNEmeWQ2 xWPYuHL61RjYuHYyuSVAgJE6C5ZQUMl24qIo/tDqqGeOcznWiNwYFc45HN5n0+G3lqZ3Bs PEToRXpAE2CAXsAvirlt5p9j2pesZ+0= Received: from mx-prod-mc-05.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-132-v7CvWrBAMsOOQO2nvXpNaw-1; Thu, 19 Dec 2024 14:27:42 -0500 X-MC-Unique: v7CvWrBAMsOOQO2nvXpNaw-1 X-Mimecast-MFC-AGG-ID: v7CvWrBAMsOOQO2nvXpNaw Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5B3AA1955F41; Thu, 19 Dec 2024 19:27:41 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.194.60]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 09EA4195608A; Thu, 19 Dec 2024 19:27:39 +0000 (UTC) From: Hans de Goede To: Sakari Ailus Cc: Hans de Goede , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 4/4] media: hi556: Don't log hi556_check_hwcfg() errors twice Date: Thu, 19 Dec 2024 20:27:33 +0100 Message-ID: <20241219192733.45659-4-hdegoede@redhat.com> In-Reply-To: <20241219192733.45659-1-hdegoede@redhat.com> References: <20241219192733.45659-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.15 All hi556_check_hwcfg() error-exit paths already log a detailed reason, logging a second generic "failed to check HW configuration" error is not useful, and in case of the fwnode check failing with -EPROBE_DEFER this is outright problematic flooding the log with: [ 6.336318] hi556 i2c-INT3537:00: failed to check HW configuration: -517 [ 6.339006] hi556 i2c-INT3537:00: failed to check HW configuration: -517 [ 6.346293] hi556 i2c-INT3537:00: failed to check HW configuration: -517 [ 6.356129] hi556 i2c-INT3537:00: failed to check HW configuration: -517 [ 6.380316] hi556 i2c-INT3537:00: failed to check HW configuration: -517 etc. The one exception to all hi556_check_hwcfg() error-exit paths already logging an error is on v4l2_fwnode_endpoint_alloc_parse() errors. Make hi556_check_hwcfg() log an error in that case too and drop the duplicate "failed to check HW configuration" error logging. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2307279 Signed-off-by: Hans de Goede --- drivers/media/i2c/hi556.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c index 57c51d0e9c4e..9b5b657f75f9 100644 --- a/drivers/media/i2c/hi556.c +++ b/drivers/media/i2c/hi556.c @@ -1226,7 +1226,7 @@ static int hi556_check_hwcfg(struct device *dev) ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg); fwnode_handle_put(ep); if (ret) - return ret; + return dev_err_probe(dev, ret, "parsing endpoint failed\n"); ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk); if (ret) { @@ -1334,11 +1334,8 @@ static int hi556_probe(struct i2c_client *client) int ret; ret = hi556_check_hwcfg(&client->dev); - if (ret) { - dev_err(&client->dev, "failed to check HW configuration: %d\n", - ret); + if (ret) return ret; - } hi556 = devm_kzalloc(&client->dev, sizeof(*hi556), GFP_KERNEL); if (!hi556)