Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2332852ybz; Thu, 23 Apr 2020 16:12:01 -0700 (PDT) X-Google-Smtp-Source: APiQypJ/1UbCq6kCHDPMoee1EU3ViK477R5g4ZxQzR0gGjh1sp6VAaf+EadYdiBL+QxtZnRp5J9/ X-Received: by 2002:a17:906:459:: with SMTP id e25mr4821044eja.379.1587683521757; Thu, 23 Apr 2020 16:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587683521; cv=none; d=google.com; s=arc-20160816; b=skMnqKk1qbs1Z5eV1GUlKKFDWQ1vNnDUVsFJ7bcXOzBQNymXJGuQnJX5pmjMbuKAHv CF1URTxtir7LLZVdzIXBP16K6H9YKjjtata76aVhRlk9lOQXZ3r0Yav8Req/iR5z0LMT 1IYsRcNaDCL+PjyAUJNA5trF0J/1pIJR9sIQRfUDwuk21O5k+rAcbSsCmTcGn+waBvCp Ct3FQwuvkc2z+1ffg8xiys+oP+8gqvDHHJ9xLFSh1mOnH4AI8Jk1TzbKgDsTLiallYHs EzqMPxY2dyytdy6p9/C8CsMFv4hysb9Xe6Bg9of5mCb6DE85C5DgzIHWSB7WcoM0LqH5 mbiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=nwD8fIofTRePaRgALjbEpdCUwvLAgyCh80xf2ngza+Y=; b=sx1jxr24AzcPQ6sExKHtGcFcASzz0rEbO8ZaifePIEAvsUN6H0LcBF47VKq/rSEmLf I118J/mUazUDK2IoC2vR74pZ2yKBZvTb4CAqJRb4w4S2/rtrV1NoKcyLB+VMkrOh3olj zbi0LsPwu+e6/ZeTQCk3OdZ41gUp7V2AACUpXioDW0WaXK7BQGP6SmA/8ue1SuYzPiP+ Ddz/WtEuzFKHxgtNiMaFh6p7e3v/3P8oO10khfRGz+Nw/nU6jef965J6uosrZFEW+eRC iZzuxEsTeS694+qqUyN9Jd20ZoUIUBXA/tICe0oZP402lxH0oW2ep0ZmL3VTfmHYxg2e qXvw== ARC-Authentication-Results: i=1; mx.google.com; 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 ks15si2123638ejb.223.2020.04.23.16.11.38; Thu, 23 Apr 2020 16:12:01 -0700 (PDT) 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; 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 S1728052AbgDWXJK (ORCPT + 99 others); Thu, 23 Apr 2020 19:09:10 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50926 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728662AbgDWXG6 (ORCPT ); Thu, 23 Apr 2020 19:06:58 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkvl-0004zc-MR; Fri, 24 Apr 2020 00:06:53 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvj-00E738-2j; Fri, 24 Apr 2020 00:06:51 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Richard Cochran" , "David S. Miller" , "YueHaibing" Date: Fri, 24 Apr 2020 00:07:41 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 234/245] ptp: Fix pass zero to ERR_PTR() in ptp_clock_register In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: YueHaibing commit aea0a897af9e44c258e8ab9296fad417f1bc063a upstream. Fix smatch warning: drivers/ptp/ptp_clock.c:298 ptp_clock_register() warn: passing zero to 'ERR_PTR' 'err' should be set while device_create_with_groups and pps_register_source fails Fixes: 85a66e550195 ("ptp: create "pins" together with the rest of attributes") Signed-off-by: YueHaibing Acked-by: Richard Cochran Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- drivers/ptp/ptp_clock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -218,8 +218,10 @@ struct ptp_clock *ptp_clock_register(str ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid, ptp, ptp->pin_attr_groups, "ptp%d", ptp->index); - if (IS_ERR(ptp->dev)) + if (IS_ERR(ptp->dev)) { + err = PTR_ERR(ptp->dev); goto no_device; + } /* Register a new PPS source. */ if (info->pps) { @@ -230,6 +232,7 @@ struct ptp_clock *ptp_clock_register(str pps.owner = info->owner; ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS); if (!ptp->pps_source) { + err = -EINVAL; pr_err("failed to register pps source\n"); goto no_pps; }