Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp489464pxb; Tue, 3 Nov 2020 05:08:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdCllK+AIE6TeC6c6SfBPCXpg7h+HugfVQ3pWkkWsvWQMNjPLZcgrsR90bDsCvPJG0UZWk X-Received: by 2002:a50:ed90:: with SMTP id h16mr20833754edr.255.1604408883523; Tue, 03 Nov 2020 05:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604408883; cv=none; d=google.com; s=arc-20160816; b=a6n5RDjVNLHogUZsFVmrbJPjxlHt+BmcgopZsRY/Uj91yFJPx8HUhtK8g6h6MLOEeb LfeSplGUoqsQ59+wTEqXVe5IGZroCbr00EUnoxvIZ0Hza96OY5TBuoyqWm1ETFqprQfI aFEb8GzbrYAUhNcqTSzWoPbYrOE7ebujQ5MRaKkfvR6N2JW7+vkhAYWKEy+mnp+jP47q TpRAi9iWAf8IuiNeSOroYSiInHC5DN2FcneS0f3u38/ai1v5X5WcZNi9MDPnRklPUlpt yhWx7St/LrEaGyy22OlHaEjD2/18cegNIyYvUtwpg1mxw7sYK/zVWoQjnhIB8WWVsW2o zRKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject:sender:dkim-signature; bh=cIpaFkFp4++37tUYsl1oQTduHULdzmm6equ1s8NaxJ4=; b=iuJtaOwDqEwOufxqm96xRXDhHIR0VZQWxBeOWEEmXYElgV+r5SwP1PqAeNh7B0LoSx zoDYHFl6vULj12cMwN9AdX7WyYNBA/wbKpLRKpsPt7EGSI4jpweRofBtNmIQuS4PGr96 dmahYlegF8k/pgM2S0N/xlgkQZ8B6A7W5C5KtRZOYQ3DqYtg5eAOA+3CP+2+Eju8mjHA TuWfc8NeAIXO4QuiZHFupL2Hu1Z2N4VkIfbhVRUdElWD7OJR67AgnFzYzMMEf+lpIlxD aqDCFdHBas9i5HUHeZtbZ53ejAetQfjMHOR77KdRT0fNUNYGsf3HlPj5ShZfzuxf1F5p P8jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=myv4FyVs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si6818788ejc.11.2020.11.03.05.07.40; Tue, 03 Nov 2020 05:08:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=myv4FyVs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729028AbgKCNFs (ORCPT + 99 others); Tue, 3 Nov 2020 08:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729095AbgKCNFn (ORCPT ); Tue, 3 Nov 2020 08:05:43 -0500 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C22C0613D1; Tue, 3 Nov 2020 05:05:43 -0800 (PST) Received: by mail-ot1-x342.google.com with SMTP id b2so15838320ots.5; Tue, 03 Nov 2020 05:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cIpaFkFp4++37tUYsl1oQTduHULdzmm6equ1s8NaxJ4=; b=myv4FyVsFmOcbT9NaT6D6F+mc2En+2qS4CMFpOKx1DhvcEvYYLmGBnAV9cLJ2twons kZAQTuZoWJuigde/HeO/nBh99h5EVBbp/v3umFcuoSuhyilddyxi9szlv+wDGZ8OdQr2 e/2sfKX56vmWYFbEjjtuGwgfWR4gIxi0Xc33eFoBhKPI/JGIAA4V0fdIg/Y6mBHxmOoN iBWC5oN+g0DzqpRkMUenkQb6Me5y5rtJKqGvPq3xjlxlDtIPNq+ZhjiLosKp3APVsJmb 7Vh9wYXCXPhvKE0NBgTgWhjGYIgTIY0KiSCzY1TgHr2njyxSQ8c3LXhvcF02OycVnO3S fykw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=cIpaFkFp4++37tUYsl1oQTduHULdzmm6equ1s8NaxJ4=; b=XEaxqoA1hSQyESgHNSC8AdxFmg1+mEHaM55dtxiOHQvPWW5y+I56TPa+OgSHk5Nts8 fdjwCFKUzbB69j/dlG40XBRJWOCBADmRioeLqPHDRZ2Fq1iGLpznsKnssgZmPPmFQO4I 4qweDRqbam0GAwQdgzPaPR+0Vjz+dE/0JtjiUt7ycwnysDQLE7ySC8vx786Lt/3Xsu0z Vb/MLz8YkN9Qk6fS/xPuOgvOL5ahXKQLzouAAQtjqO2i6MhiHN1hsJZatitRZTFCqFC1 EtKayjyscY6SPinvDyIMaIHOKHCqVPYqlXdtstkIhNqxZl/1Uzswjb2bUEvz6xM55deW PDMQ== X-Gm-Message-State: AOAM530mpLLrP2PmM0ELpvHbhvfuMPLEx9/ebROiglrDaMuwhFl+2X83 88vc+kktDCiy4+Y6mOeuhS8= X-Received: by 2002:a9d:4d09:: with SMTP id n9mr15516478otf.334.1604408741534; Tue, 03 Nov 2020 05:05:41 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id v11sm4396539otj.73.2020.11.03.05.05.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 05:05:40 -0800 (PST) Sender: Guenter Roeck Subject: Re: [PATCH -next v2 1/2] watchdog: Clean up error handlings of __watchdog_register_device To: Christophe Leroy , Wang Wensheng , wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rui.xiang@huawei.com, guohanjun@huawei.com References: <20201103065217.67876-1-wangwensheng4@huawei.com> <11e45cab-108f-db0e-6350-82ae49ed6b23@csgroup.eu> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7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hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <6b57c174-97d0-eb48-0a6e-a7af992c316f@roeck-us.net> Date: Tue, 3 Nov 2020 05:05:38 -0800 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: <11e45cab-108f-db0e-6350-82ae49ed6b23@csgroup.eu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/2/20 11:05 PM, Christophe Leroy wrote: > Hi, > > Can you provide in the commit a description of what you are doing and why ? > Also, I'd rather have this as second patch to make it easier (possible, actually) to apply the first patch to -stable. Guenter > Christophe > > Le 03/11/2020 à 07:52, Wang Wensheng a écrit : >> Signed-off-by: Wang Wensheng >> --- >>   drivers/watchdog/watchdog_core.c | 17 ++++++++++------- >>   1 file changed, 10 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c >> index 423844757812..c73871f41142 100644 >> --- a/drivers/watchdog/watchdog_core.c >> +++ b/drivers/watchdog/watchdog_core.c >> @@ -252,10 +252,8 @@ static int __watchdog_register_device(struct watchdog_device *wdd) >>           wdd->id = id; >>             ret = watchdog_dev_register(wdd); >> -        if (ret) { >> -            ida_simple_remove(&watchdog_ida, id); >> -            return ret; >> -        } >> +        if (ret) >> +            goto id_remove; >>       } >>         /* Module parameter to force watchdog policy on reboot. */ >> @@ -273,9 +271,7 @@ static int __watchdog_register_device(struct watchdog_device *wdd) >>           if (ret) { >>               pr_err("watchdog%d: Cannot register reboot notifier (%d)\n", >>                      wdd->id, ret); >> -            watchdog_dev_unregister(wdd); >> -            ida_simple_remove(&watchdog_ida, id); >> -            return ret; >> +            goto dev_unregister; >>           } >>       } >>   @@ -289,6 +285,13 @@ static int __watchdog_register_device(struct watchdog_device *wdd) >>       } >>         return 0; >> + >> +dev_unregister: >> +    watchdog_dev_unregister(wdd); >> +id_remove: >> +    ida_simple_remove(&watchdog_ida, id); >> + >> +    return ret; >>   } >>     /** >>