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.6 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=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 11348C433ED for ; Mon, 17 May 2021 11:13:01 +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 8BD5561166 for ; Mon, 17 May 2021 11:13:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BD5561166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=foss.st.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-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vI7Vscblj7ASt497SI84L+vWdJWeAHhnvhOOzeLtfE8=; b=YkmUH9t64Yaoj9LemQfBSC0n7 SjTiuin9xmeYzA7E9KLOBJn3jS+5tcM9OrTabbB6HtpBbxIQmAhromcVeEaN77qhvA92C3ragbGA+ /amGL8+M+TYjIWoUZOfam+iv8lfm/9m7L+SkAM+k+utlc4g0gGOg3FC450+20FLKLio3ZvvIOO7ww FWPLVfEcIeLFLrLSVtBfvwulzKHTFy7xpkiPpHwbq00A0qUPlMxcpndDFrViGDniUub/bZmf3uHRb TBxTv1e6od4Vkle87wzjb/xlELhE4ko4QMScFFoR+6QUi1AhRh95KIPSEdqslN+veicr50nYaepDU snyCzq6OA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lib9T-00Egq5-S4; Mon, 17 May 2021 11:11:12 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lib8Y-00Egjm-BQ for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 11:10:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:CC:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=EKOIUbX1y29itg1jYefnksaqL8GhgGWV9RXQZFgcTyw=; b=J1gQfgGkZDQtggd91nDebzoeV9 zVuOqJh52Phb7wXQssDD+p40U3qy/VEUiyh+Blo17JNF0xpjzRHHdPAdjv9PqilYdd+a7s8U1LQwt xJkcu6OSp4xORaZBlvd4VliDhlGuY6+GqQAtCLyYE2xXg+m8HgSW6oA3AR/SHElNs/9DKHqS6E0xX QxQMF29pZEDM1El6ya9rTRTHBTwqUBd7b69PqFw15mrdAVAGNwaLOK3sqVlaReI66YbPY81IoNL09 KvHEC0F10uGNyYbiIQ5AFyeoHBN8czArg5erVegecDI3BT3SWG4bKbIIHUvfU9bsdjQiPAirjbWbf 4VMrCVGQ==; Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lib8V-00Dhjg-3K for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 11:10:12 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14HB1c3k009108; Mon, 17 May 2021 13:10:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=EKOIUbX1y29itg1jYefnksaqL8GhgGWV9RXQZFgcTyw=; b=aqmjFNnQkqYk8L5tXuoBPZKT0/o/bl531K3Ix2Nvc4AXYMdOAbXTolVPjMTcgNpzWXir PqzzclKI7E7GOhP0l/R6PQkrOenGbEQtUaOYkqTk/UcYI//A0tGnpAOuN3u5ZH2nKPpf RQz5QopXSIDuga9XNpESy/7ttcye+Q1PriagyeV8hb1xDsEcjcgYsyG9ECto37p40EA1 0WRlrqYiwxdnkVDBGKa4vgRtxKg4Fhs5+dQEkpsmrh0ra3+KURbezMI0iUMVWECgdC4T EWHncUho/5mEbWxT6YNYos/FjtQayiFLSg7HLnLz6CxHx8dXbNm5ENtWa92ZNNzXghxs Rw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 38k5dq4d9k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 May 2021 13:10:01 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1F62A100038; Mon, 17 May 2021 13:09:59 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7920722871C; Mon, 17 May 2021 13:09:59 +0200 (CEST) Received: from lmecxl0573.lme.st.com (10.75.127.48) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 17 May 2021 13:09:58 +0200 Subject: Re: [PATCH] media: st_rc: Handle errors of clk_prepare_enable() To: Evgeny Novikov CC: Sean Young , Mauro Carvalho Chehab , , , , References: <20210515123909.5638-1-novikov@ispras.ru> From: Patrice CHOTARD Message-ID: <7dfaeeae-04e5-68d1-0949-991b0a7d6640@foss.st.com> Date: Mon, 17 May 2021 13:09:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210515123909.5638-1-novikov@ispras.ru> Content-Language: en-US X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG2NODE1.st.com (10.75.127.4) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-17_04:2021-05-17, 2021-05-17 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_041011_451512_64E055C8 X-CRM114-Status: GOOD ( 24.79 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Avgeny On 5/15/21 2:39 PM, Evgeny Novikov wrote: > Hadle errors of clk_prepare_enable() in st_rc_hardware_init() and its > callers. > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Evgeny Novikov > --- > drivers/media/rc/st_rc.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c > index 3237fef5d502..f524fcf55acf 100644 > --- a/drivers/media/rc/st_rc.c > +++ b/drivers/media/rc/st_rc.c > @@ -157,8 +157,9 @@ static irqreturn_t st_rc_rx_interrupt(int irq, void *data) > return IRQ_HANDLED; > } > > -static void st_rc_hardware_init(struct st_rc_device *dev) > +static int st_rc_hardware_init(struct st_rc_device *dev) > { > + int ret; > int baseclock, freqdiff; > unsigned int rx_max_symbol_per = MAX_SYMB_TIME; > unsigned int rx_sampling_freq_div; > @@ -166,7 +167,10 @@ static void st_rc_hardware_init(struct st_rc_device *dev) > /* Enable the IP */ > reset_control_deassert(dev->rstc); > > - clk_prepare_enable(dev->sys_clock); > + ret = clk_prepare_enable(dev->sys_clock); > + if (ret) > + return ret; > + > baseclock = clk_get_rate(dev->sys_clock); > > /* IRB input pins are inverted internally from high to low. */ > @@ -184,6 +188,8 @@ static void st_rc_hardware_init(struct st_rc_device *dev) > } > > writel(rx_max_symbol_per, dev->rx_base + IRB_MAX_SYM_PERIOD); > + > + return 0; > } > > static int st_rc_remove(struct platform_device *pdev) > @@ -287,7 +293,9 @@ static int st_rc_probe(struct platform_device *pdev) > > rc_dev->dev = dev; > platform_set_drvdata(pdev, rc_dev); > - st_rc_hardware_init(rc_dev); > + ret = st_rc_hardware_init(rc_dev); > + if (ret) > + goto err; > > rdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; > /* rx sampling rate is 10Mhz */ > @@ -359,6 +367,7 @@ static int st_rc_suspend(struct device *dev) > > static int st_rc_resume(struct device *dev) > { > + int ret; > struct st_rc_device *rc_dev = dev_get_drvdata(dev); > struct rc_dev *rdev = rc_dev->rdev; > > @@ -367,7 +376,10 @@ static int st_rc_resume(struct device *dev) > rc_dev->irq_wake = 0; > } else { > pinctrl_pm_select_default_state(dev); > - st_rc_hardware_init(rc_dev); > + ret = st_rc_hardware_init(rc_dev); > + if (ret) > + return ret; > + > if (rdev->users) { > writel(IRB_RX_INTS, rc_dev->rx_base + IRB_RX_INT_EN); > writel(0x01, rc_dev->rx_base + IRB_RX_EN); > Reviewed-by: Patrice Chotard Thanks Patrice _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel