Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5046466imm; Tue, 12 Jun 2018 01:24:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIR4rEQfeiUwrDfpjjzMs4xEnYIMTCIE9BrkrIhHtIqFbZ0zoNrWr8mVfELXry/kzS4HaUx X-Received: by 2002:a62:2091:: with SMTP id m17-v6mr359624pfj.110.1528791887342; Tue, 12 Jun 2018 01:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528791887; cv=none; d=google.com; s=arc-20160816; b=tKjTB9aJokpW5oEQb0QgFXa9NWkFh6UMfOVG4t2XY8qwHxDM2qyPwf5KcJ8X0MQLMk pDkofpzmVDnFbNlEyUnmhM6T9hHhI8Hs6tzudWjXHRfrEPH0C3V2GQq+i7bwtInN5nGv 1wwh+fCAoT87m+dBIZCEE4hG2CemX6Wdf6amMXkalpULeCPqCR5p59AxYE4W2B81VgxG oXHY/9BC3msb3CddCme1gdMaalY8CgPYLFQw4nH68jnM25za/7dmJqIunilTKTP/2hYp w3ql6gzy1vDZojStlrOxaZLP3ihs/iTiXoSoonkwrQZBGLR75mTiOhCq1r95ApiOK+nd T9Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=CZTKMGQhaEXUpki4HAcbTgo9Gh8kAYC5Q8V9YpgBhjc=; b=XJeqherzzsja55967Irh+SX1V3p2rJOiX81LU97R0b5oZRfuVA0cABRmMvLGt3arLJ 9Vy3979wW5GxMZmEh4RDPZ7AQGy8Ux+A++d5QmPbDrajltky7pkJgRFO0pfyO9M/tsTA 73xmk9n8q7NvsZvX07/gL6KGG4QSVktCIB1KOvdAVv2h6D7Ndt0OvHIDisrjNwyTFb9T pjm3kvlBmNO+KfJgeqdfUZc+FxM/jjb3c5DRAH1hb8lEIazXRCAnXlGLsahr5KOB6HX3 caA7R/lnlR/p+ge68u9Gkt3kVmXQ9rlLu6MDo1KiNzgy3ojLx7pIUnkrPG1mrItDKw1c Gjww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="TXs/sPrC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12-v6si299369pll.319.2018.06.12.01.24.33; Tue, 12 Jun 2018 01:24:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="TXs/sPrC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933600AbeFLIXc (ORCPT + 99 others); Tue, 12 Jun 2018 04:23:32 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:34982 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932497AbeFLIXa (ORCPT ); Tue, 12 Jun 2018 04:23:30 -0400 Received: by mail-ua0-f194.google.com with SMTP id s13-v6so11940441uad.2; Tue, 12 Jun 2018 01:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CZTKMGQhaEXUpki4HAcbTgo9Gh8kAYC5Q8V9YpgBhjc=; b=TXs/sPrC9jSPuMP2RYBMoRfmrpHBuJyQ7VtfEQ1//6TueUn6WIu4q/E3QtVuzI9tyY zlXIImv3lVtig+VlNWwdKn2DDfkJPJKJeX1ZzpTmxBlxBg7Z4YRKAF+gCbnVtLDGsqRm qx+kxAaJnzHRKXW2hh1X/rSqUQecl/ZG5vAcEbC7JL/1ZHD40x77SCHTynK91+HJ2JdD reNvjVuM4EOQ5qG+Xf8tOks4Aw71EipV/F4zC/4MLGt3aRBM9JrsOeOV+iPajBUqords dWfjC/dyr3IMmST11zzjnhSts0pNupCptVOfgAtHd3YT3oQGl4OuhDsVVUT8UAGJATcv NRYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CZTKMGQhaEXUpki4HAcbTgo9Gh8kAYC5Q8V9YpgBhjc=; b=soZTttxZij9KUwTULTWB0G6Cl/8SapDDHZJhgjA7G/IhrsxvEYQtDsBZyViguxXF0W WhjiTaCiYuhJ/SdfCSBL918/g7Tq2TNuAnP/pRP+OykHUcyc6fcLa6yN7QqO5t1fghdg ol7y5l73eRwGxk0T8MCriggJz1AsxIYjQvcHrQ7caOri1XdECyUAjAsfqSi+EkauFfSi G05IhGHu5iBFKxmwsnKs83Tiqp0NWY/CDNX/YONlUGMB50E6/22nneyIwIy0966smzZN WHM5SePcTotAyYbzhUXJewCgL3xVoonZFJDniHH7DZU1wzN75Fk9QkJ/FIRw5QCud8OZ UaHQ== X-Gm-Message-State: APt69E0d8j0itsWpbH1R0/LOyw01QDCWtD1JjnjG1J4nnFvLrKhG8k/v FlDZ8gtrAgaJ+nBBxT4hdNluu60giuxMbORXt2E= X-Received: by 2002:ab0:1b9b:: with SMTP id k27-v6mr1725088uai.122.1528791809496; Tue, 12 Jun 2018 01:23:29 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:8b02:0:0:0:0:0 with HTTP; Tue, 12 Jun 2018 01:23:29 -0700 (PDT) In-Reply-To: <1528779046-42341-1-git-send-email-jiazhouyang09@gmail.com> References: <1528779046-42341-1-git-send-email-jiazhouyang09@gmail.com> From: Andy Shevchenko Date: Tue, 12 Jun 2018 11:23:29 +0300 Message-ID: Subject: Re: [PATCH] tty: serial: add error handling for try_module_get To: Zhouyang Jia Cc: Jason Wessel , Daniel Thompson , Greg Kroah-Hartman , Jiri Slaby , kgdb-bugreport@lists.sourceforge.net, "open list:SERIAL DRIVERS" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 12, 2018 at 7:50 AM, Zhouyang Jia wrote: > When try_module_get fails, the lack of error-handling code may > cause unexpected results. What results? What is recovery approach here? How printing message change a behaviour? > This patch adds error-handling code after calling try_module_get. > + if (!kgdb_connected) { > + if (!try_module_get(THIS_MODULE)) > + printk(KERN_ERR "kgdboc: cannot get module.\n"); So, what's wrong with pr_err() ? > + } -- With Best Regards, Andy Shevchenko