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 4808113792B; Thu, 12 Dec 2024 16:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734022662; cv=none; b=YIVZlSCtVXa0tMTrerd9WX0OmA7+57b27nL6r+Gfq26CYvSgD40t7HbntXAwTxNpSOI2QTGCqK7syHEGtPZJTM2peC/KFRg7Ww1waA7SShsYNxtuvII9a+VkxWTzyN0AqpXmCOBeG8eVVoJjcWPnTVzKtxBTPi874zW3B8UX66k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734022662; c=relaxed/simple; bh=YWSLv5uk9vK8ZW0wstHmdyxCq2nsCYR+U1J6cCmZsOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fqc5FRzdoXVMXugxMYJ3Q8d01YlvAex2gjSjqXsPlmbnT4S3fhmlzIelzvLEC+D+9Y0gKEXz6LGaXnNEA13RQtSRSGoaLPf/ExA+21dqymjtuojqYMK+dP/g8dctyP82pV86kOJ4Gr2/O3efuy7jDJoaVf372o8ddPWL0ufVUaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l/OkSK21; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="l/OkSK21" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A892DC4CECE; Thu, 12 Dec 2024 16:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734022662; bh=YWSLv5uk9vK8ZW0wstHmdyxCq2nsCYR+U1J6cCmZsOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/OkSK21KqoV6lEDpJXXPifkJzeRqDGoRDVIkQPtOHB2gGmEJPXhO25RIIQMeoP/c oiNZ8InT/k7nkSetueEbJpmCAz6pd8Vcfny5suS4q5UdLISaGijjD7DQg/8NnM6IfT DJmJN5Wzo/g8FKuUDRbY+eobXBxb7z55PlXtvuUw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Manikanta Mylavarapu , Konrad Dybcio , Bjorn Andersson Subject: [PATCH 5.15 302/565] soc: qcom: socinfo: fix revision check in qcom_socinfo_probe() Date: Thu, 12 Dec 2024 15:58:17 +0100 Message-ID: <20241212144323.404962953@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144311.432886635@linuxfoundation.org> References: <20241212144311.432886635@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Manikanta Mylavarapu commit 128fdbf36cddc2a901c4889ba1c89fa9f2643f2c upstream. In success case, the revision holds a non-null pointer. The current logic incorrectly returns an error for a non-null pointer, whereas it should return an error for a null pointer. The socinfo driver for IPQ9574 and IPQ5332 is currently broken, resulting in the following error message qcom-socinfo qcom-socinfo: probe with driver qcom-socinfo failed with error -12 Add a null check for the revision to ensure it returns an error only in failure case (null pointer). Fixes: e694d2b5c58b ("soc: qcom: Add check devm_kasprintf() returned value") Signed-off-by: Manikanta Mylavarapu Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20241016144852.2888679-1-quic_mmanikan@quicinc.com Signed-off-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman --- drivers/soc/qcom/socinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -614,7 +614,7 @@ static int qcom_socinfo_probe(struct pla qs->attr.revision = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%u.%u", SOCINFO_MAJOR(le32_to_cpu(info->ver)), SOCINFO_MINOR(le32_to_cpu(info->ver))); - if (!qs->attr.soc_id || qs->attr.revision) + if (!qs->attr.soc_id || !qs->attr.revision) return -ENOMEM; if (offsetof(struct socinfo, serial_num) <= item_size) {