Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1914557yba; Fri, 10 May 2019 03:16:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqziGY39JYB/q3gDlgWMHT0eOkeu6deK2rdpJzEO4LN+obiXxpRD6Km7SmM7D8uB2sIWy1uo X-Received: by 2002:a17:902:e60a:: with SMTP id cm10mr3373772plb.316.1557483412612; Fri, 10 May 2019 03:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557483412; cv=none; d=google.com; s=arc-20160816; b=OKmRexPYEbBmBN9gFGfkPQMAb/1dtrZz0zavVqZwfNcuJphBebykqru+O223Wcpt0P rrwSb1vCk4ASuwL+ftmD0R5gw0dn8J5WvXq8Rfh5TpGZPYEjVXKmwi47SCdQ99j2KuGR E9N9JSMawkuelChhHl91segCEa/23W0b+15M2t2Ca6002/UjZ7DZLE7RMufn38wx4VON xNrymkzmaiQD3DM+D5C9JuYqwLrlevpgB/yyhgTzA3YJZv5m6DUUVgBmXMbZ1CinsKvE DRBcCPpopBxYIDtEBprTrOiL8cNgMsE8LxIWPOiInSSun6Y279Ly0xZOCIrN00hSN0x3 0htQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZiHkOP2G2KBbMO/HwvwcUOiTAwVa4lhyxJmh7593C1E=; b=t5Aq9yEZB+NorBC0F8Sa/QBonEhXXlDH4yCRW4ncxJcvyxa7nWRQzlmpDDN+M9quFo TISlhGYTB0XDYMmY/ypjIdXB8N3ea1bXcrfnIa7AX92NxQzzQOifiBxiW1sNceeMvIPm qJQlz+lCZByfjqTpBUgKJWg0mufO+rEJ+xM/ORlrvKub+pWJ5Rw/VYD6o2+ZXSChsvE2 LGqC2JabTYUhDfPUvV+E4PO42y8AJ+5aCLfN3nuFb0++ZorgevznljVgPtImNDxWQmxD SXmBdB+ddYlyX+CLWeKc9jwlqH05w5+JXAC2z2s3c99fYutQ9VI4juXs4iMcLI91iS/W vwyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="ogX/j60k"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si6787375pfr.262.2019.05.10.03.16.35; Fri, 10 May 2019 03:16:52 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="ogX/j60k"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727520AbfEJKOv (ORCPT + 99 others); Fri, 10 May 2019 06:14:51 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:40089 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727424AbfEJKOu (ORCPT ); Fri, 10 May 2019 06:14:50 -0400 Received: by mail-ot1-f65.google.com with SMTP id w6so5075724otl.7 for ; Fri, 10 May 2019 03:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZiHkOP2G2KBbMO/HwvwcUOiTAwVa4lhyxJmh7593C1E=; b=ogX/j60kJFhWOj6V0oSFEwlDh/tPi8tp2P8nuLAish7AmQXvhIwXXEvRb8/i5hrTST OSOHGtqMnxqRo3fIDJ+kuEsRKt6fzL1/3vA52js8Zv47WChTsY0Hjp53kqfFoY5GProz ClRpFI8F9F7655kpqzYEzYb+veI5Ctj6O92ODEfDe1Qf/XP9zj3CRS31zu/7zRgOHxsm BhKTPSbIEO43dKNh0sPjqq+gFmRejlvcrTIB/LDYo0kaOZ2TD28Qgf+ue/SOxvOImkt9 Gb8ayFu9YinSXscDdSLdb5RhcwG0s4HdIoazReYYFC/VKQCHUdx+X4z+ug0pweM5iE5t hY1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZiHkOP2G2KBbMO/HwvwcUOiTAwVa4lhyxJmh7593C1E=; b=HrKiD2tf228pzbCf73Yz/thxsxcVey2Tdza67cwrBGH66VU4+HKh7QJ60Quf81RM4b uoymDOVwkCRzQKy1xlakI9vv6EnaEk4hdgNzKclZ9RwTPwfvuOAkHEJqdpfWdI+UM97T Frky7ydAS4ifF3Stzh5TKjp77sjrD/a4yJjFdAqzSUWPJe9AvwW1CEJO/URz+EP+YAQh 37YPiGEp4qaU/ZqqPst3RHLkYM4ovOjfoDnyuTeFfFYdB6oDzGZI8YkXGRfe+67tWI4z 7OVKARtlDhHN4oQMwGOFWmD5wU3ENjhJYQ+BPLEiweBHhTTWiXwfCQ9qlKy0UbhtXTt9 cSZQ== X-Gm-Message-State: APjAAAVykkHXN7ZFQeBA2OUEHIlA32OOE0UtQwE5JlO1YmMGNN7DMVu8 T/8h4y0aVj/XVnoJkUW1Gx3DwrIfq5BG2xtxNPDN6A== X-Received: by 2002:a9d:12f5:: with SMTP id g108mr6418092otg.56.1557483290159; Fri, 10 May 2019 03:14:50 -0700 (PDT) MIME-Version: 1.0 References: <20190510095832.28233-1-colin.king@canonical.com> In-Reply-To: <20190510095832.28233-1-colin.king@canonical.com> From: Bartosz Golaszewski Date: Fri, 10 May 2019 12:14:39 +0200 Message-ID: Subject: Re: [PATCH][V2] reset: remove redundant null check on pointer dev To: Colin King Cc: Philipp Zabel , kernel-janitors@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pt., 10 maj 2019 o 11:58 Colin King napisa=C5=82= (a): > > From: Colin Ian King > > Pointer dev is being dereferenced when passed to the inlined > functon dev_name, however, dev is later being null checked > so at first this seems like a potential null pointer dereference. > > In fact, _reset_control_get_from_lookup is only ever called from > __reset_control_get, right after checking dev->of_node hence > dev can never be null. Clean this up by removing the redundant > null check. > > Thanks to Philipp Zabel for spotting that dev can never be null. > > Addresses-Coverity: ("Dereference before null check") > Fixes: 6691dffab0ab ("reset: add support for non-DT systems") > Signed-off-by: Colin Ian King > --- > > V2: remove null check point, it is redundant. > > --- > drivers/reset/core.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/reset/core.c b/drivers/reset/core.c > index 81ea77cba123..921f4bbbad8a 100644 > --- a/drivers/reset/core.c > +++ b/drivers/reset/core.c > @@ -694,9 +694,6 @@ __reset_control_get_from_lookup(struct device *dev, c= onst char *con_id, > const char *dev_id =3D dev_name(dev); > struct reset_control *rstc =3D NULL; > > - if (!dev) > - return ERR_PTR(-EINVAL); > - > mutex_lock(&reset_lookup_mutex); > > list_for_each_entry(lookup, &reset_lookup_list, list) { > -- > 2.20.1 > Reviewed-by: Bartosz Golaszewski