Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp307817pxm; Wed, 2 Mar 2022 16:00:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjvuIWVeWhbCWsfw2JjUaUzRMs0zVFFzMAvCe6gPmZv3M7Lgl7N1aiXHQu/gGOIRGTugvB X-Received: by 2002:a65:6d8b:0:b0:376:bfb9:1f3b with SMTP id bc11-20020a656d8b000000b00376bfb91f3bmr24892487pgb.427.1646265653679; Wed, 02 Mar 2022 16:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646265653; cv=none; d=google.com; s=arc-20160816; b=RTCBF9H11f4AmlztRRL1dIvmLty+/aPZS7KBmjCJYEWCUwffL2ojv1k+DPv9Vbs20R W5G8vPvx9qdvhC7J/VSnRLI/xoNy4GZRConl9JgEz8UQyqhiNVAZroOb2NWzzt4/X4ns 6v5OhGrj8eLXprksKdz7nZRvLF0JGmRL9fiYNDT0/k3Fo75CWcHuOog5HJ5/AfNN4Fjq 9mxYk5UKk0j/QJwLPRLCqeWL7a85rV3b9wDySlGFSN4mv05Viljx+vKzl/i4Jw0bHnfQ hEi+3kq6/if+WLndmjv2Orkh9sD4eaVzq1JAlcQkd+iuCWAYRGQPNpf+ewlJXhtv3Jl3 igaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O3o33HiAlAkKWePglOBZ60JYtBt9Yzo2sRdnF+CUZ9A=; b=wczBd2xYOJGGi0gcAJFWG1YavfLh6bbQVLVDH3Wb3XZDA91WCxqzrLeDwVBzdVu3Vu TV90FlFFERBOeHpG/DykXHak3nDIOWYjpXrJa/YkgoRbLh7GU2huElHmRq78fj5KD9ZT vv9kBGXOg7aIVpqfaNLLGzLFMY0kUaeAf6DoQoRmKRyFAbZ2J/fKIH8APvS11fekacKQ 7EW40pjBYOhy8gXIddDPwa8lVlnrNrLUeoOZUbvgVtmT6BUBiQfF+iGc15qyA0dwNVcy Zuqwv+7SHC+i+MwChNODp+emQN+30LSLgVnfyuU8Q4duSPxryoyokfQWSYKzVi1thKDC CufQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CaPt6T8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n9-20020a63b449000000b0037865a76ab4si438585pgu.323.2022.03.02.16.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 16:00:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CaPt6T8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 978F419DE90; Wed, 2 Mar 2022 15:19:57 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240675AbiCBJsf (ORCPT + 99 others); Wed, 2 Mar 2022 04:48:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240648AbiCBJsb (ORCPT ); Wed, 2 Mar 2022 04:48:31 -0500 Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [IPv6:2001:4b98:dc4:8::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9449F6478 for ; Wed, 2 Mar 2022 01:47:44 -0800 (PST) Received: (Authenticated sender: alexandre.belloni@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id AF1D6200011; Wed, 2 Mar 2022 09:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646214460; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O3o33HiAlAkKWePglOBZ60JYtBt9Yzo2sRdnF+CUZ9A=; b=CaPt6T8MIMXQLv7E0/HYOOBFtZ2rmiP4jd+Dnp/e6rBwnLRTJX783XWCGRjscENBIdpj16 D8hWDAZwQYi5W3XAJGqOf8DNjx5o8O47IhroWFle+3O2/Piq5U/PL22C4nruc1y8Co7Xmc S50Xn/ni1PsiK8ll6WO/nkO4VH16MrJNxvpTetv8+Mg4OJx+M+hUyb4dssX7xftS+/TLue hvT4pURbDsNTI3LDCFO8wrpHaejBLp/ZFGhrJF9m4HTmpllBGquXma9jcnyqjoszj7eBYd h49LnNOQrz9cSizdXrlx9XBnZHt6qwC/isOTSzQSdiSH/9cbwUMH1yTtp1UMyA== Date: Wed, 2 Mar 2022 10:47:39 +0100 From: Alexandre Belloni To: Jiasheng Jiang Cc: codrin.ciubotariu@microchip.com, arnd@arndb.de, gregkh@linuxfoundation.org, nicolas.ferre@microchip.com, claudiu.beznea@microchip.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] misc: atmel-ssc: Handle error for clk_prepare Message-ID: References: <20220302084902.96651-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220302084902.96651-1-jiasheng@iscas.ac.cn> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 02/03/2022 16:49:02+0800, Jiasheng Jiang wrote: > As the potential failure of the clk_prepare(), > it should be better to check it and return error if fails. > This will never ever fail, this doesn't fix anything > Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91") > Signed-off-by: Jiasheng Jiang > --- > drivers/misc/atmel-ssc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c > index d6cd5537126c..e0207e837e35 100644 > --- a/drivers/misc/atmel-ssc.c > +++ b/drivers/misc/atmel-ssc.c > @@ -25,7 +25,7 @@ static LIST_HEAD(ssc_list); > > struct ssc_device *ssc_request(unsigned int ssc_num) > { > - int ssc_valid = 0; > + int ssc_valid = 0, ret; > struct ssc_device *ssc; > > mutex_lock(&user_lock); > @@ -57,7 +57,9 @@ struct ssc_device *ssc_request(unsigned int ssc_num) > ssc->user++; > mutex_unlock(&user_lock); > > - clk_prepare(ssc->clk); > + ret = clk_prepare(ssc->clk); > + if (ret) > + return ret; > > return ssc; > } > -- > 2.25.1 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com