From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A815DC43460 for ; Wed, 7 Apr 2021 15:56:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8188461132 for ; Wed, 7 Apr 2021 15:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232798AbhDGP4Q (ORCPT ); Wed, 7 Apr 2021 11:56:16 -0400 Received: from foss.arm.com ([217.140.110.172]:59716 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347463AbhDGP4N (ORCPT ); Wed, 7 Apr 2021 11:56:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1A4A61063; Wed, 7 Apr 2021 08:56:04 -0700 (PDT) Received: from [10.57.26.91] (unknown [10.57.26.91]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E88DF3F694; Wed, 7 Apr 2021 08:56:02 -0700 (PDT) Subject: Re: [PATCH] memory: samsung: exynos5422-dmc: handle clk_set_parent() failure To: Krzysztof Kozlowski References: <20210407154535.70756-1-krzysztof.kozlowski@canonical.com> From: Lukasz Luba Cc: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-ID: <1906533a-e86a-10fe-5bc3-4600af98d579@arm.com> Date: Wed, 7 Apr 2021 16:56:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20210407154535.70756-1-krzysztof.kozlowski@canonical.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Krzysztof, On 4/7/21 4:45 PM, Krzysztof Kozlowski wrote: > clk_set_parent() can fail and ignoring such case could lead to invalid > clock setup for given frequency. > > Addresses-Coverity: Unchecked return value > Fixes: 6e7674c3c6df ("memory: Add DMC driver for Exynos5422") > Signed-off-by: Krzysztof Kozlowski > --- > drivers/memory/samsung/exynos5422-dmc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c > index 56f6e65d40cd..9c8318923ed0 100644 > --- a/drivers/memory/samsung/exynos5422-dmc.c > +++ b/drivers/memory/samsung/exynos5422-dmc.c > @@ -1293,7 +1293,9 @@ static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc) > > dmc->curr_volt = target_volt; > > - clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll); > + ret = clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll); > + if (ret) > + return ret; > > clk_prepare_enable(dmc->fout_bpll); > clk_prepare_enable(dmc->mout_bpll); > Thanks for running these tests and for the patch. I've checked how many many places this function is used in the kernel and return is ignored - in a lot of places... This patch LGTM. Reviewed-by: Lukasz Luba Regards, Lukasz From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43E14C433ED for ; Wed, 7 Apr 2021 15:58:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8DAC61382 for ; Wed, 7 Apr 2021 15:58:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8DAC61382 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:Cc:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=az4uci7zBX4344ntC1jw8pQAa3jcp/noLynl2oD8wEQ=; b=CavWUj1+LWWgSlrvnber0fnxh rZDuaQ2MjvDJUNKDdahxo3MR2I83UZBvn6GTE2wApe26RzoOH0GRHffBEZ3DGHmJEEXl+Grv6lTSE QaOSS0wgbuYR70ljtEvvy6sBK4XfqVJYf2Rk4b+7D3gr3rKFlQUO/dK8yuXLvm2Pebt6A1b1+YgUf sp2qSiBYg8dOUugDfyRm1cIGrJXHhSUKsrb1Buluv+UFwv6tVQuoAnlHBxhcHBEVqe/z4qhiahSit 0FOpmhQzG6RAJXPJ3p6T5DBmHd3GayCx8N6/d1STSwuv0j7hyCQgHPyxhQNaAM0wpoF1Fwqj5//jR 0vefL1SXw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUAXU-005Lux-5m; Wed, 07 Apr 2021 15:56:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUAXF-005Lrh-G9 for linux-arm-kernel@lists.infradead.org; Wed, 07 Apr 2021 15:56:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1A4A61063; Wed, 7 Apr 2021 08:56:04 -0700 (PDT) Received: from [10.57.26.91] (unknown [10.57.26.91]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E88DF3F694; Wed, 7 Apr 2021 08:56:02 -0700 (PDT) Subject: Re: [PATCH] memory: samsung: exynos5422-dmc: handle clk_set_parent() failure To: Krzysztof Kozlowski References: <20210407154535.70756-1-krzysztof.kozlowski@canonical.com> From: Lukasz Luba Cc: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-ID: <1906533a-e86a-10fe-5bc3-4600af98d579@arm.com> Date: Wed, 7 Apr 2021 16:56:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20210407154535.70756-1-krzysztof.kozlowski@canonical.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210407_165605_819949_FAB9459E X-CRM114-Status: GOOD ( 19.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Krzysztof, On 4/7/21 4:45 PM, Krzysztof Kozlowski wrote: > clk_set_parent() can fail and ignoring such case could lead to invalid > clock setup for given frequency. > > Addresses-Coverity: Unchecked return value > Fixes: 6e7674c3c6df ("memory: Add DMC driver for Exynos5422") > Signed-off-by: Krzysztof Kozlowski > --- > drivers/memory/samsung/exynos5422-dmc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c > index 56f6e65d40cd..9c8318923ed0 100644 > --- a/drivers/memory/samsung/exynos5422-dmc.c > +++ b/drivers/memory/samsung/exynos5422-dmc.c > @@ -1293,7 +1293,9 @@ static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc) > > dmc->curr_volt = target_volt; > > - clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll); > + ret = clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll); > + if (ret) > + return ret; > > clk_prepare_enable(dmc->fout_bpll); > clk_prepare_enable(dmc->mout_bpll); > Thanks for running these tests and for the patch. I've checked how many many places this function is used in the kernel and return is ignored - in a lot of places... This patch LGTM. Reviewed-by: Lukasz Luba Regards, Lukasz _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel