From patchwork Thu Jan 26 15:06:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 13117331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 507B9C05027 for ; Thu, 26 Jan 2023 15:07:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232207AbjAZPHi (ORCPT ); Thu, 26 Jan 2023 10:07:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232172AbjAZPH2 (ORCPT ); Thu, 26 Jan 2023 10:07:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32E196BBEC for ; Thu, 26 Jan 2023 07:07:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE93EB81DEF for ; Thu, 26 Jan 2023 15:07:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D26EBC433A4; Thu, 26 Jan 2023 15:07:16 +0000 (UTC) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Hans Verkuil , Sakari Ailus Subject: [PATCH 15/17] media: i2c: adp1653: introduce 'no_child' label Date: Thu, 26 Jan 2023 16:06:55 +0100 Message-Id: <20230126150657.367921-16-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230126150657.367921-1-hverkuil-cisco@xs4all.nl> References: <20230126150657.367921-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The code mixed gotos and returns, which confused smatch. Add a no_child label before the 'return -EINVAL;' to help smatch understand this. It's a bit more consistent as well. This fixes this smatch warning: adp1653.c:444 adp1653_of_init() warn: missing unwind goto? Signed-off-by: Hans Verkuil Cc: Sakari Ailus --- drivers/media/i2c/adp1653.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c index a61a77de6eee..136bca801db7 100644 --- a/drivers/media/i2c/adp1653.c +++ b/drivers/media/i2c/adp1653.c @@ -420,7 +420,7 @@ static int adp1653_of_init(struct i2c_client *client, child = of_get_child_by_name(node, "flash"); if (!child) - return -EINVAL; + goto no_child; if (of_property_read_u32(child, "flash-timeout-us", &pd->max_flash_timeout)) @@ -441,7 +441,7 @@ static int adp1653_of_init(struct i2c_client *client, child = of_get_child_by_name(node, "indicator"); if (!child) - return -EINVAL; + goto no_child; if (of_property_read_u32(child, "led-max-microamp", &pd->max_indicator_intensity)) @@ -459,6 +459,7 @@ static int adp1653_of_init(struct i2c_client *client, err: dev_err(&client->dev, "Required property not found\n"); of_node_put(child); +no_child: return -EINVAL; }