Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752699AbcJKTq5 (ORCPT ); Tue, 11 Oct 2016 15:46:57 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:33592 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752553AbcJKTqx (ORCPT ); Tue, 11 Oct 2016 15:46:53 -0400 From: Rob Herring To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Dan Carpenter Subject: [PATCH 2/2] driver core: fix smatch warning on dev->bus check Date: Tue, 11 Oct 2016 13:41:03 -0500 Message-Id: <20161011184103.17744-2-robh@kernel.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161011184103.17744-1-robh@kernel.org> References: <20161011184103.17744-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 937 Lines: 30 Commit d42a09802174 (driver core: skip removal test for non-removable drivers) introduced a smatch warning: drivers/base/dd.c:386 really_probe() warn: variable dereferenced before check 'dev->bus' (see line 373) Fix the warning by removing the dev->bus NULL check. dev->bus will never be NULL, so the check was unnecessary. Reported-by: Dan Carpenter Signed-off-by: Rob Herring --- drivers/base/dd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 8937a7ad7165..d76cd97a98b6 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -384,7 +384,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) if (test_remove) { test_remove = false; - if (dev->bus && dev->bus->remove) + if (dev->bus->remove) dev->bus->remove(dev); else if (drv->remove) drv->remove(dev); -- 2.10.0