Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2718065iog; Mon, 27 Jun 2022 01:05:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1se/1KNaPsdvDklMD1AoKhbNTOK4PhQSinZWcO3Ur+P37bG57kYqT+i408oHUpVeZfqwrPb X-Received: by 2002:a05:6402:3551:b0:435:a397:4e9b with SMTP id f17-20020a056402355100b00435a3974e9bmr15389995edd.175.1656317136320; Mon, 27 Jun 2022 01:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656317136; cv=none; d=google.com; s=arc-20160816; b=nimEXMQVhIZLOdBnUsnDryjQXUQbw87NAiVhvzgw8mhP4XYgeBLCIZiB4BNjyMMoeu GvltXDyZi38v3lWHDGKjPSVKTojtoOFwyrUSNCZq67yPB1txQQqqyjyYc97S1tc9D+il nFfVQrL/i+Zl39R2pT8L/9AibTZ9NUe90Ke5cRD2jL57OQ85WW1g+tYumzRt2RmzrBA1 cIHX1/Lf+qSNHy06mwPmp/6IjmNXM24hyKkd/0pUVNCfcJI94oQKQxvY7cErgHFv2NKo OVGwIptfqWecsxKdq3j0NI8oLiZjVJiSYsuYxDymuYNuIEU/lDM/t81ZgPL6UlOxOHtv oWng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3/xYBvTS2qq8X2jYmD4R5OmGfCZvLTdRBCPoxzlOb9I=; b=uQqdRIkBvmST5FLHiMmKKDG5mdNmyDFpx8dZQlXWB51xCDVQHSmIWdMay6i+zq/l8t XW71eTfrw2glBkqoenaoj/SwwE67tUayu/S8/Tft4iyxjzs1ey5E9nuCavLGTJVoCAW8 kFjmETsx8GeJAgcG+0VyvFfmoSe6Fz9Tcl1D5jEva9MjofGAnqXc1B8s+ydIWQPyjEdw whBulVhLTMHqpPKDpgkJYZVlVwQqahYyI7ViKQC840rDHYJFXA8hWn6Lkaf6yI3GkZJd 0dvWgU3NrE0deh4QkAzUBEReMSR8k8ulYRZ+jlAYDpigVnnl/Rc4mSO1otUZDQ8ZlYbK Z95g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020aa7cd57000000b0042dec850ef4si10673189edw.486.2022.06.27.01.05.12; Mon, 27 Jun 2022 01:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233237AbiF0H6g (ORCPT + 99 others); Mon, 27 Jun 2022 03:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233212AbiF0H6a (ORCPT ); Mon, 27 Jun 2022 03:58:30 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C21B2B3; Mon, 27 Jun 2022 00:58:27 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LWg6q4d1BzkWfM; Mon, 27 Jun 2022 15:57:07 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 27 Jun 2022 15:58:25 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 27 Jun 2022 15:58:24 +0800 From: Yang Yingliang To: , CC: , , , Subject: [PATCH -next v2] rtc: rv8803: fix missing unlock on error in rv8803_set_time() Date: Mon, 27 Jun 2022 16:08:22 +0800 Message-ID: <20220627080822.3881072-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the missing unlock before return from function rv8803_set_time() in the error handling case. Fixes: f8176e0bb83f ("rtc: rv8803: initialize registers on post-probe voltage loss") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Reviewed-by: Sascha Hauer --- v2: correct fix tag. --- drivers/rtc/rtc-rv8803.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c index fe1247e771b9..3527a0521e9b 100644 --- a/drivers/rtc/rtc-rv8803.c +++ b/drivers/rtc/rtc-rv8803.c @@ -315,8 +315,10 @@ static int rv8803_set_time(struct device *dev, struct rtc_time *tm) if (flags & RV8803_FLAG_V2F) { ret = rv8803_regs_reset(rv8803); - if (ret) + if (ret) { + mutex_unlock(&rv8803->flags_lock); return ret; + } } ret = rv8803_write_reg(rv8803->client, RV8803_FLAG, -- 2.25.1