Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp37488rwj; Wed, 21 Dec 2022 22:36:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXtjHEnb5f4+U1m1I2Rq9G1UYUkpwZGLwcbX7AfKR410X2XzFBA5dnuOHSAigG3db1kjlfs6 X-Received: by 2002:a05:6402:2b89:b0:461:ca30:653 with SMTP id fj9-20020a0564022b8900b00461ca300653mr4860743edb.31.1671691000295; Wed, 21 Dec 2022 22:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671691000; cv=none; d=google.com; s=arc-20160816; b=hcx8NWrQ+ZgjWhM1gL5x8OmwOBZWs+4dM3yJ+Uexout2ZzXlVjRjMbJU3KfryT3Npt fCeDywTzOcrG7TnawUIe97ETzMRzA4h89YlAuhuM3SR1nwDXTr6J/ytJK1A/c8urbKpt QSztpxGcYlk5Iy2NMIOGjnEfWtA/ZXq0ZCRjN+n8oUo0pnExbycWSMwlBaSOsRf0qXiO +pAkyQJcKBZ4f2h7FyC/3TwkCrJWJsbgwrsvkkYdnNUg0avtdBzDBbFrhhWQ9J/xPEwt eUtaKcOJNAEWAaXSeVZjlgKpxdiBIFlPik9tQghpKj8lDMCqvF16xGwanjLXKOGfO2vb sLMw== 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=x401bl0yV+mo4K/qtAsJ4ob/ZkTa4aLrgIkyLob9yDE=; b=WBFsuG/WyKnqtJqdjOD0arKc8/iVnLwt7KL7iafO0LObWcZ8O6RgET9YSUh1a72muz TmbbAAbO0DVl6850OUofFPZskT4LV6IXKoBYFba6GRcb9tpx9grLCb/5Kxm1GA/7oYaV 14b2XCUrjs7LKOtByQw5T1t9UQXKXKgVOow7Obl/0aSoZwGrxGPVcC+tWtyawDOIAiKG in2W2wptFVo0G6QdBDitMAjbv1Gyt2Jz8NBQAGCNB489ZGncc5vKgHGPH3yLwVfYc4tL JfjW/jscGNvLI8TCbUGmwIWSstct4GaAy/GSSBOW8wjqzXinZUtLiuVJoPdOfhCt7jV8 M15w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cb5/JgXj"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r1-20020a056402018100b0046154884604si4682926edv.482.2022.12.21.22.36.24; Wed, 21 Dec 2022 22:36:40 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cb5/JgXj"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234964AbiLVFzK (ORCPT + 67 others); Thu, 22 Dec 2022 00:55:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbiLVFzH (ORCPT ); Thu, 22 Dec 2022 00:55:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EADE99; Wed, 21 Dec 2022 21:55:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B05A6619B6; Thu, 22 Dec 2022 05:55:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57001C433EF; Thu, 22 Dec 2022 05:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1671688505; bh=TRscKl5gR6cr50JxhDtAZyUtxqv9kZrOWAk32Jm8tDk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cb5/JgXj7bheGLLuH7nYeDxU1yxbN/nfWGvuc2ljVOikHK8ZQOJ20sBlNeVjvb5mv 3a3gNDbR6XnTU631XArBepSMV2mHUgK7gSVn9QplTf1ubkXB0fpZLh33srIW4jSG4o eUZhY3wGxLmC1Pc744bZD2yybA1bhho/afoamfWM= Date: Thu, 22 Dec 2022 06:55:01 +0100 From: Greg Kroah-Hartman To: Deepak R Varma Cc: "Maciej W. Rozycki" , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Saurabh Singh Sengar , Praveen Kumar Subject: Re: [PATCH] tty: serial: convert atomic_* to refcount_* APIs Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Thu, Dec 22, 2022 at 01:27:40AM +0530, Deepak R Varma wrote: > The refcount_* APIs are designed to address known issues with the > atomic_t APIs for reference counting. They protect the reference > counters from overflow/underflow, use-after-free errors, provide > improved memory ordering guarantee schemes, are neater and safer. > Hence, replace the atomic_* APIs by their equivalent refcount_t > API functions. > > This patch proposal address the following warnings generated by > the atomic_as_refcounter.cocci coccinelle script > atomic_add_return(-1, ...) > > > Signed-off-by: Deepak R Varma > --- > Note: The patch is compile tested using dec_station.defconfig for > MIPS architecture. Do you have this hardware? If not, please just do one-variable-at-a-time so that if there are real problems, we can revert the offending change easier. And it makes it simpler to review. But, are you sure this is correct: > - irq_guard = atomic_add_return(1, &mux->irq_guard); > - if (irq_guard != 1) > + refcount_inc(&mux->irq_guard); > + if (refcount_read(&mux->irq_guard) != 1) That is now different logic than before, why? Are you sure this is ok? I stopped reviewing here... thanks, greg k-h