From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9EBA2BA3E for ; Tue, 7 Mar 2023 17:44:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 253E2C433EF; Tue, 7 Mar 2023 17:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678211070; bh=dMfLHGXqCV58j67NNjONufX/DRzADM+jNNP7F/CLS34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sUlPLKK6w3hRlqqYe/Pq1y8jQMD6+PmvhXY3IMM1v3xPof/nsyR/QKTAYVDh32o/e UejzFXzy7RI/GNPuOCO2Y7sFJLpEflWFqTG1W/jcs015FXwVqccHD3KnUl784ZF9bh B9xuLNHGV+mrCKIRFzY+MnOyYWpp2weRYOUCO6D8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vladimir Oltean , Dmitry Baryshkov , Saravana Kannan , Sasha Levin Subject: [PATCH 6.2 0743/1001] driver core: fw_devlink: Avoid spurious error message Date: Tue, 7 Mar 2023 17:58:35 +0100 Message-Id: <20230307170053.976963097@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170022.094103862@linuxfoundation.org> References: <20230307170022.094103862@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Saravana Kannan [ Upstream commit 6309872413f14f3d58c13ae4dc85b1a7004b4193 ] fw_devlink can sometimes try to create a device link with the consumer and supplier as the same device. These attempts will fail (correctly), but are harmless. So, avoid printing an error for these cases. Also, add more detail to the error message. Fixes: 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust") Reported-by: Vladimir Oltean Reported-by: Dmitry Baryshkov Signed-off-by: Saravana Kannan Link: https://lore.kernel.org/r/20230225064148.274376-1-saravanak@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/base/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 126b10c8e0ce9..6ed21587be287 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2088,9 +2088,9 @@ static int fw_devlink_create_devlink(struct device *con, goto out; } - if (!device_link_add(con, sup_dev, flags)) { - dev_err(con, "Failed to create device link with %s\n", - dev_name(sup_dev)); + if (con != sup_dev && !device_link_add(con, sup_dev, flags)) { + dev_err(con, "Failed to create device link (0x%x) with %s\n", + flags, dev_name(sup_dev)); ret = -EINVAL; } -- 2.39.2