Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1472930lqt; Sat, 20 Apr 2024 17:52:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkAJM9I7qEeN3q4vtkRnihaHkpXshvlHSVkKpGYZ5zzfhlGvjIu5Tt/JA3ZhncBdl8nTzHvJLFO/Agjz6zJ+wCqlM5sgWDd0ppE8P69Q== X-Google-Smtp-Source: AGHT+IFjlnRYQdTJUwoDo54ir6JbvJfAd3b8IkQyb7k5EmFKdTVk9iHk0q+aieDzzGtIegTp/z/V X-Received: by 2002:a05:6870:858c:b0:239:5b8:5c9e with SMTP id f12-20020a056870858c00b0023905b85c9emr7141755oal.11.1713660775055; Sat, 20 Apr 2024 17:52:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713660775; cv=pass; d=google.com; s=arc-20160816; b=QGQiPeK1mq/aYCMr2Qq9EraaNdo3HOcBYoF44jPtWtpJadrjHWVbkENxpVMyoAJQsT 8HT7a5dE3BFRNWXCUq11Pb2k0mzYZ9Fl/WH+C9C2CQhM/l8y51VPpBsBBpfx+RnsUv+T o1PzIlpmTjBo5jeFbm2HNTl/sAEKVwexSFXIW2RiDI5KHrdQl2L5l9Zrfr2ECjYSwQsQ Nccky1Bf0MuK1e2q9b0G174TFjot6eUtV0pn9hhcprG0jTJTirMwCAfLoElBGK5ZJ6dQ oTe/iQBO1ExTPw+3POvF6kf3c1+e7mVJje/eSBFCFbiiFpWLR0P/HygIgcEvJ7FO5rRv yW6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=mmTndY/6V+l9GSOwkbZ4WVLq9rAPWNK6WqHx8cTBU4U=; fh=r2sbs8dMNQLIxE4qaiY8iYml83t3Gm1253raWX3y4tg=; b=SmGszL0o2Hrysd10HOuGcWIlD3Gg4rcHtDnIcezeXO/gLf1FRJyzpRSNIIdKJSC7tD 87ZVycoCr+EAC2J9k1PoQkpElqThJD7eLoRvzfVExfldoPn2vF6M4qneeewOIa4jJbGC j3lMB6px0ORHYGG7d1N5cCOGoWDbwnPBXo8NjShYXgmZc7hWWD7s6xIXBnVv05hazldL EuCiysZfDeB2uV3MrqfPxnYpcHHMq3ynwa1JJnDoEC0hlw1JA0D90j5CiN4QgPygTCSn KVvZIFRutzmrIEZIMZTRQZVDPjlN0SZI9JA0QuM26JzANfFpaKpqzG7tExyCqgwbdiZ/ e5qw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uutnxb2U; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-152401-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152401-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b10-20020a17090a12ca00b002a20d2cf9e8si5507131pjg.157.2024.04.20.17.52.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 17:52:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152401-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uutnxb2U; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-152401-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152401-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 45891B20E96 for ; Sun, 21 Apr 2024 00:52:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C62104409; Sun, 21 Apr 2024 00:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Uutnxb2U" Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F29E38C; Sun, 21 Apr 2024 00:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713660756; cv=none; b=dXZzGDcT3bXTv0w1s6cJqfKQJsFRJrlTasrqXfS1XyKICdroArYVd8OK3PFLEhvgdu23VNDhbXHdk/Fknmam3NpJvjstXz6J/e+tweDqlPnmDAbSfj9VkSGNKF27s7oVobzdobPigBWhzvhmulb/XGpYKNMbkvSsWB33JQyiNE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713660756; c=relaxed/simple; bh=kltL7WY9gysVRwFonfEBaD1Sdt2tE1k3lWQtkRMHR2Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ONS20y7mwG5i+5si7gRCqLcoPc52bQdTYudd+viCUeVqvs7BlDQStZ4EKKaWH1oFjpvxpILYh02FoSTDXbDmq2iP+6UISnIS5ts0pVHxDRptloe+hG58vjHKeeU59KJGCM3Hs4yBV0aFDpw4R/tx3ThmFwfPJ+T4490/ncxxQ5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Uutnxb2U; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6ed112c64beso2859369b3a.1; Sat, 20 Apr 2024 17:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713660754; x=1714265554; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mmTndY/6V+l9GSOwkbZ4WVLq9rAPWNK6WqHx8cTBU4U=; b=Uutnxb2UpTPMM81WWFrba6xDaj9k4BzTyGDKUN0vH7qVA/ecTjU+CO0DdlKb+mw3Oo PHSVzxyfkS1vHlwNS6jMRX3YkOTM4Yr5yiskHIFTwodoyV8o8vw9w0V0hhqPO/VpBfG1 aQS2BRYiL6C5i3R696wwDqzSOW+GmmsJ/TCnxby6+IdVH5FVkNrDjAq+hLVacqgTkQr0 2ORj8F7SmJJc90OmpWgvN6rd1Cyyd+f2kQaFW97OEYQax96JmBbKlZvfzJm9D/cYQ65J FDUp4N4Fh959s7SuFU9iyUsnlxkIEefReMDcyfPAzSNRxF2B8psoKIBYvL/ODQcCkA1s pulg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713660754; x=1714265554; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mmTndY/6V+l9GSOwkbZ4WVLq9rAPWNK6WqHx8cTBU4U=; b=ORVFluAKTI7GQoNrR7SblzE8XcNBqZc/DIXB1KZn9wZLXGXxevoi9Lg5bBSMbD6S4h JbRDwmUGXdmzFv92UzpomREPkhI6Ojdf3d0nKYVb3qCOIF93OIBlWQjh858iE/WlJYgY HrnzypH/4CTjgIqggSlyMpyeaODJV+fYhYtnBFhXhM+e5qD1U4INwBCC6Q4VG/IMrWkt cVK20eQWe2dtOviqeUhbbMywjRM10S5jc5pdbPEWosYH98ur/N6P2sZWMi8HJZZUeF6+ xztzaITbHc/ujQxB52waQXLQBf866mNMI5YatfhxHfaa0oWqKo/DYYxBOJMVNLciWkSY zjUA== X-Forwarded-Encrypted: i=1; AJvYcCU7oPKoGMXrgBq8K6pTumf0cXeDIbDp3wMLFWhO1TE0ke54fOa3qP0jk4FVnaN6pZ5slUaDxMmGd4Iv+GVGadLMCmrkX/5liQQKoJnXAOsTaR5vBan9KTeUUBY3jjAxXQkCURaU57Jf X-Gm-Message-State: AOJu0YynW/z6Y25qnfxsgA6BNHZkEkZ/VViGYINcygXt4Fhi/GY5QqO7 etbFLTpOeDxbMcX/l171Tdz4bUy9GTXBsEvbgk/adcsBqav37H6N X-Received: by 2002:a05:6a00:8806:b0:6ed:de70:5ef8 with SMTP id ho6-20020a056a00880600b006edde705ef8mr4766994pfb.6.1713660754612; Sat, 20 Apr 2024 17:52:34 -0700 (PDT) Received: from ?IPV6:2402:e280:214c:86:f91:84f5:d87e:d36d? ([2402:e280:214c:86:f91:84f5:d87e:d36d]) by smtp.gmail.com with ESMTPSA id 13-20020a056a00070d00b006e69a142458sm5381470pfl.213.2024.04.20.17.52.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Apr 2024 17:52:34 -0700 (PDT) Message-ID: <2231ae20-05ff-4292-861a-4d90a07fc50a@gmail.com> Date: Sun, 21 Apr 2024 06:22:29 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] remove indentation for common path [linux-next] To: Dmitry Baryshkov Cc: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, neil.armstrong@linaro.org, u.kleine-koenig@pengutronix.de, christophe.jaillet@wanadoo.fr, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com References: <20240420164927.15290-1-prosunofficial@gmail.com> Content-Language: en-US From: sundar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 21/04/24 02:17, Dmitry Baryshkov wrote: > On Sat, 20 Apr 2024 at 19:49, sundar wrote: >> >> Added check if pointer is null and removed indentation for common path >> >> Suggested-by: Greg Kroah-Hartman >> Signed-off-by: sundar >> --- >> >> Fixed nitpicks in code according to comments received on other patch. >> >> https://lore.kernel.org/all/2024041103-doornail-professor-7c1e@gregkh/ >> >> goal is to get rid of of_node_put,but sending this patch first to do one >> thing at a time. >> >> Changes since v1 - fixed the typo error for spell from identation to >> indentation >> >> v1 patch link - https://lore.kernel.org/all/20240420145522.15018-1-prosunofficial@gmail.com/ >> >> drivers/usb/typec/mux/nb7vpq904m.c | 49 +++++++++++++++--------------- >> 1 file changed, 25 insertions(+), 24 deletions(-) >> >> diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c >> index b17826713753..fe0257840dd5 100644 >> --- a/drivers/usb/typec/mux/nb7vpq904m.c >> +++ b/drivers/usb/typec/mux/nb7vpq904m.c >> @@ -321,35 +321,37 @@ static int nb7vpq904m_parse_data_lanes_mapping(struct nb7vpq904m *nb7) >> >> ep = of_graph_get_endpoint_by_regs(nb7->client->dev.of_node, 1, 0); >> >> - if (ep) { >> - ret = of_property_count_u32_elems(ep, "data-lanes"); >> - if (ret == -EINVAL) >> - /* Property isn't here, consider default mapping */ >> - goto out_done; >> - if (ret < 0) >> - goto out_error; >> - >> - if (ret != DATA_LANES_COUNT) { >> - dev_err(&nb7->client->dev, "expected 4 data lanes\n"); >> - ret = -EINVAL; >> - goto out_error; >> - } >> + if (!ep) >> + return 0; >> >> - ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT); >> - if (ret) >> - goto out_error; >> + ret = of_property_count_u32_elems(ep, "data-lanes"); >> + if (ret == -EINVAL) >> + /* Property isn't here, consider default mapping */ >> + goto out_done; >> + if (ret < 0) >> + goto out_error; >> + >> + if (ret != DATA_LANES_COUNT) { >> + dev_err(&nb7->client->dev, "expected 4 data lanes\n"); >> + ret = -EINVAL; >> + goto out_error; >> + } >> >> - for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) { >> - for (j = 0; j < DATA_LANES_COUNT; j++) { >> - if (data_lanes[j] != supported_data_lane_mapping[i][j]) >> - break; >> - } >> + ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT); >> + if (ret) >> + goto out_error; >> >> - if (j == DATA_LANES_COUNT) >> + for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) { >> + for (j = 0; j < DATA_LANES_COUNT; j++) { >> + if (data_lanes[j] != supported_data_lane_mapping[i][j]) >> break; >> } >> >> - switch (i) { >> + if (j == DATA_LANES_COUNT) >> + break; >> + } >> + >> + switch (i) { >> case NORMAL_LANE_MAPPING: > > switch-cases should also be shifted one level to the left, see > Documentation/process/coding-style.rst > >> break; >> case INVERT_LANE_MAPPING: >> @@ -360,7 +362,6 @@ static int nb7vpq904m_parse_data_lanes_mapping(struct nb7vpq904m *nb7) >> dev_err(&nb7->client->dev, "invalid data lanes mapping\n"); >> ret = -EINVAL; >> goto out_error; >> - } >> } >> >> out_done: >> -- >> 2.34.1 >> > > Hi Dmitry, Thanks for the review.will fix my code. Thanks, Sundar