From patchwork Sat Jan 4 20:54:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13926370 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 809B81D5CD4 for ; Sat, 4 Jan 2025 20:54:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024086; cv=none; b=cd+hx7S1Y1Gd/J2/G5Bd9EmRZZ4LDHdt+MiABx7zwBHSo88WKY4UHXsSLoPt1cY2HAj7czD0FyaitflQQiPOjVaNdqoOyFFwJag77qYsYQTViKWUVGy6xHcv/IyV1+QfX945GAQX9T16DJpyrp+QTfmVUXmjuv8cdes2Abmk4KI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024086; c=relaxed/simple; bh=fYNFkZ4E49jBh8K15pvFiL/fAUn0j4KNd1uS/SNnNLc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=n5lDOwISIy9ycZ5/oGR90AoM1Z5++kxt/YVagSYVmFmzXe0lJQUp7288J35F2TbVRrf0z1pIdF8bDYVnSx4BgX77W3L/Hsyw/rzneOMFMfMGU58lCgwBtdcO5zcDo4ylnPiQAfk7/3n4+AjGiiJHjMPi8vfLUhXB8PQtxChsEto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=f+CxS3Fs; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="f+CxS3Fs" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5d0bf4ec53fso2740073a12.0 for ; Sat, 04 Jan 2025 12:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736024082; x=1736628882; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BMnEf52UfAT7r8nhxUJ27WGRgof8roegZaPYvjI6+Zo=; b=f+CxS3FstA746ECg9npg4+CiwW5WlafE12tuQam5CYW0TdFKRhBfbQLd8RD6s4gfl7 Nd7h7dVqIncK8pygkk/z7eVV19BlwVZAYZ0AcIDG6cfdB8qHlKcbxZ2nv9Har/TPgH+F 26hBP4L7bh6Vk808mIEjhII5fsKHUxyFu/caELwVAfhBqLDD/3dAg7SxajJPNK2rkqtK EUq6/cUh7VSgd/Pr9hkomoNjgwWoqPVAKmtyGvGtvnOEVvMO5Ncgp0EmbtFZB9nw7fGw cFCIZAyFWkL52JELQ+AvST7f3twucq45I5lqKiDI3P+W5Epz5l7KFf3zPqX7Myj/tLyf +oZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736024082; x=1736628882; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BMnEf52UfAT7r8nhxUJ27WGRgof8roegZaPYvjI6+Zo=; b=FVuf9hj2Rg0V+CIEMLCDhlp7PWeknFA7Z3eVZabg9U9QWYh1EZA0Dh4hltzqydQ2rR 9n5XAjbkyc7ns18sJ9KO2K98UTAJiOmS+iscGwAKuamXtdNpkiMADpwgRQtJbhWvstce krM/EMcHjgXJJ9Xhi2LX9Wlk0EO/15J7eke9tLCYCCiM2a1PqTPPkLMBvFoDO4qohRQy rREp3By5slVImT6kcTA8Ph8dRF55QzxBMS6KimBD2HEUv3lX272uLn8O3lY8CBk4S5Ga n8l22IUnhjYp/2qSm4TCvTlURIKJj7XohKzv+5RMeANV4134X0n3ab49nWDdBHQoX30b zMqw== X-Forwarded-Encrypted: i=1; AJvYcCXEWY9vvePmQ/CDGeVQHAVVxtRY+sWXE+7dsGNxfBU7K32jxYdaJmVJb2nnSUr2vO47haoCQCRotug=@vger.kernel.org X-Gm-Message-State: AOJu0YzxxKCL8IzllOrM5agFu2hBCYkpaSyC/Wxld868m/ocrdcfXa6K hEbwCYzvz/AkcG6MF7PCxxdqIcamPWNJz4+opsGBWbqDPhb8G4ehx2qEelw6/bg= X-Gm-Gg: ASbGnctaQqNUgtcphR4qjeeVd/r5pHArS8xqtyTUzn+yvJYTSipADggsMu+UCYlaHj1 o974+UZCuwi27X8q7wEfp8miurlg7b9kqbWjlYyp1INSZ3G5+DkrkIvhaMrk1oGxTnTDkIggRaH KU/hSS6MVJ584fKf2v/DNxwbXqDgSMJ528tauyAOrBc0C+XWvhavajDexS2mWgiMGK8ydjNwpPg FYZfUvw4x6pmeb4AQiz2LeAeXJmqwzX+aw1wb0kgXg/SlEK9vCNv1KdkdXi2WVjFLfV41k= X-Google-Smtp-Source: AGHT+IFLOaiX+zI3DneKZWxfhc5l0F3vw+qCGBukNa5K0q1p/ZxNgoJYKPDQaaRdI+EszfqyaVTwdg== X-Received: by 2002:a05:6402:2801:b0:5d3:e79b:3b4f with SMTP id 4fb4d7f45d1cf-5d81de1695bmr17922824a12.8.1736024081142; Sat, 04 Jan 2025 12:54:41 -0800 (PST) Received: from krzk-bin.. ([178.197.223.165]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aaf4a841749sm839666666b.137.2025.01.04.12.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2025 12:54:40 -0800 (PST) From: Krzysztof Kozlowski To: Mark Brown , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , David Rhodes , Richard Fitzgerald , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com Cc: Krzysztof Kozlowski Subject: [PATCH 1/4] spi: atmel-quadspi: Fix struct atmel_qspi_pcal kerneldoc Date: Sat, 4 Jan 2025 21:54:34 +0100 Message-ID: <20250104205437.184782-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Correct the typo in parameter name for 'struct atmel_qspi_pcal' kerneldoc and W=1 warnings: drivers/spi/atmel-quadspi.c:244: warning: Function parameter or struct member 'pclk_div' not described in 'atmel_qspi_pcal' drivers/spi/atmel-quadspi.c:244: warning: Excess struct member 'pclkdiv' description in 'atmel_qspi_pcal' Signed-off-by: Krzysztof Kozlowski --- drivers/spi/atmel-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index f46da363574f..d135cca4e454 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -235,7 +235,7 @@ /** * struct atmel_qspi_pcal - Pad Calibration Clock Division * @pclk_rate: peripheral clock rate. - * @pclkdiv: calibration clock division. The clock applied to the calibration + * @pclk_div: calibration clock division. The clock applied to the calibration * cell is divided by pclkdiv + 1. */ struct atmel_qspi_pcal { From patchwork Sat Jan 4 20:54:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13926371 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 832B81D5CE3 for ; Sat, 4 Jan 2025 20:54:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024087; cv=none; b=G7uQx4Y0VqmsTw9FHzBz9i98YDevriDsAGWN1lX0L139PID+8n5pS4Ipeqv5f4rRy9aGUPpD9UNQcRFFRYNF40gM61orrlSDfesRZG3v2VUdQLoR6A4GtwA/3Nhm0h17+fTashRpIEhkjRQkP203oq2LZxZrxGt6+iAw3qvueDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024087; c=relaxed/simple; bh=0pluUhxj+qHekDTaDHHUWfvMX4R8WWXSMErhdppVD4I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u4zZsCkpilS16rVb3jko4gEiyTcu6zFBIWjcSgzOkR3WFTy2BeyA4lsftkfXBLLrjv4VFxPUxysTEyQ9KJ9waPqdDcRrIbXte1QtS5vQg/GQh+xOoGSEVPj0l1gpbp43fkbujrjGSSZUHQGPH8c7p+NPIU87GKqZt+lB47bJ7p8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=IpKWDkAi; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IpKWDkAi" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-aa680fafb3eso164448266b.3 for ; Sat, 04 Jan 2025 12:54:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736024084; x=1736628884; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XLKX/DDFIRPvx5t6DaUjc92tk+3Aa7daTr762N5Ifkc=; b=IpKWDkAiY/Ttys+LjWLoxLoHZDs+pi3cu980+RD7Xi7kdylySfQRse2ik28rGbBCut wcIgmbbWU4pPHlHpYtGwTOBfgpgUo927OxMNebTOEJJYm0/JCBICliRZiRylZawj4c+k TYQ9Z8pTgn23p/mhZAip2AyGuPOSO5n6qWiD05YVgCyuX9/Cnu7JBxy31Gc9GoLSO7ez QyfLeJKYv2h3GnrWFHmav/NWnl8SP3zCipd5KTPwLU7NaX9vQeYRWcyoJ4HrL4GeuyUJ bMDbRyjnFzVNEqL16q1Dn1Bh4z98C/9mHvrFhwgcgZTIan+r9j0jq7pXsVrnkhVSpyiT fUqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736024084; x=1736628884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XLKX/DDFIRPvx5t6DaUjc92tk+3Aa7daTr762N5Ifkc=; b=WBo42p4tDv+kz3qRTAzQeEHPr1/FDUr4ZiOaKieCh5eNZlDy6AtzkAT/L5UvnuHBbr ibGLTulyTMUw4PZSR9i02MzFHVNVHSbW3kvpBA/N150bIqfMV0K3c/r1eXsFYHjOpFSd a4S9desT1o/qEF5UtmBMJnkFLEs1WRgPpZONOT7e3gk5D+rJsv/C1eLRccDiURXFIo9r oP5e5J/dZoePcojzXYtD5EvcQFiAO8X7bemOlewmipplBhxbUt0eFGH+jeqfvwCUCb7G RFyuiGS+JfN+KUGFnoFfo4bdkCu8GbbeOg3XsGFknDLBHPHITUwUPzBQa3ivYvjb6UnQ 5/+g== X-Forwarded-Encrypted: i=1; AJvYcCWISB+sJ4qX2ND8md9SdsZ6uOuY7QpX/ckEB/NjUSBjzKbkiEKTt4aPzwK9O3bcsRzKRlVo5R7wpPc=@vger.kernel.org X-Gm-Message-State: AOJu0YwxPCEDD1HahTKiT700yz6vGrDa2vj2SQ19qwK1qKpNmszVRXZ0 zrW8hhUKUmhKASKjM8oFQLBZbYyoLLfiT5Z+sfFgSWN0LCwWO1DXeu1DSkbRzPE= X-Gm-Gg: ASbGncsRmKfLoaPCsAHTRGMe805Mtf1vwL2fmMdb4ybvCr5UJFLRTYrYCeO218fT6y8 yRJ/Fxa7oLILAVZm+tK+JdwYD+G8CUaZkiMesOAf/f7+XkfW9V+1X7fJ1ll1zTOBAih+sIhxEuJ d7RdoG6o2Q5IJbDWsXPoXT6CHf0px/pA+S7huBhLsPXrPtuO1Z9RBBZfxjkD3p7ctrJbOZX8rmE sS3nIhDCCwexJnGGPdpiO8zWNEFf4dK7WE17RTiAvkpNLJKrmZDaBYpmzk5j/sGhrXSwec= X-Google-Smtp-Source: AGHT+IFmkhn29wqYEMmrNGScq5CXWT6m6SapSyW0XiDfeMVUzsZXK4EWiuoixIVsOEwexnWV5pkkww== X-Received: by 2002:a17:907:6d1f:b0:aa5:a60:ad6a with SMTP id a640c23a62f3a-aac2d4472c8mr1834711266b.8.1736024083242; Sat, 04 Jan 2025 12:54:43 -0800 (PST) Received: from krzk-bin.. ([178.197.223.165]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aaf4a841749sm839666666b.137.2025.01.04.12.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2025 12:54:42 -0800 (PST) From: Krzysztof Kozlowski To: Mark Brown , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , David Rhodes , Richard Fitzgerald , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com Cc: Krzysztof Kozlowski Subject: [PATCH 2/4] spi: atmel-quadspi: Fix printed error code during DMA setup Date: Sat, 4 Jan 2025 21:54:35 +0100 Message-ID: <20250104205437.184782-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250104205437.184782-1-krzysztof.kozlowski@linaro.org> References: <20250104205437.184782-1-krzysztof.kozlowski@linaro.org> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On dma_request_chan() failure driver NULL-ifies the 'rx_chan' and immediately uses it as PTR_ERR() so dev_err_probe() prints incorrect error code. Rework the code so proper error code will be printed and NULL-ifying of 'rx_chan' will happen in common error handling block (failure of DMA setup is not fatal for the driver and further code depends on 'rx_chan' being non-NULL for DMA operations). Reported by Smatch: drivers/spi/atmel-quadspi.c:1287 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR' Signed-off-by: Krzysztof Kozlowski --- drivers/spi/atmel-quadspi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index d135cca4e454..057bc20a74ce 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -1283,9 +1283,9 @@ static int atmel_qspi_dma_init(struct spi_controller *ctrl) aq->rx_chan = dma_request_chan(&aq->pdev->dev, "rx"); if (IS_ERR(aq->rx_chan)) { - aq->rx_chan = NULL; - return dev_err_probe(&aq->pdev->dev, PTR_ERR(aq->rx_chan), - "RX DMA channel is not available\n"); + ret = dev_err_probe(&aq->pdev->dev, PTR_ERR(aq->rx_chan), + "RX DMA channel is not available\n"); + goto null_rx_chan; } aq->tx_chan = dma_request_chan(&aq->pdev->dev, "tx"); @@ -1306,8 +1306,9 @@ static int atmel_qspi_dma_init(struct spi_controller *ctrl) release_rx_chan: dma_release_channel(aq->rx_chan); - aq->rx_chan = NULL; aq->tx_chan = NULL; +null_rx_chan: + aq->rx_chan = NULL; return ret; } From patchwork Sat Jan 4 20:54:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13926372 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 3D2041D63D5 for ; Sat, 4 Jan 2025 20:54:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024090; cv=none; b=I0lSELTrbLWRzecJsrF9vknU9SJ4eEqbW/7IEWC2aYQwWlcQyL+ZoJIrGi50KlxIBX7CdqSmixtoCFoKt7pjy9aYXsrdbELH28ART9wD6QbJV4h7v/h4W73eizP9lnQnp1cM0XJeS5MgPA4VDG5T+mTgWo+QnyXS220E/tSpDD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024090; c=relaxed/simple; bh=OVi515b6fvB1D8FMPWpdYGP+XIs4Du8HE+mgPE8IwMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QASe1hjH/6C+hBtJHYAcFP7UOdp71wimdOf/XnVVIiSkHEe0DRhAXqC+/EYpxqfOxaZdyQ3NJs7XpriSmAadBsD/lQHa7u05CPLkRXTaBnvdH4+cu+Rl8LwbZUi+nVARQjuFlyPnAuTC093aEcabdi7FqoVi5bIPDRAcn+Li9Fs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OqBLnas0; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OqBLnas0" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5d3ea2a5a9fso1976585a12.2 for ; Sat, 04 Jan 2025 12:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736024086; x=1736628886; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/5tKgeyFg00MgtfGaAYBuFBjwqBNpORNVJY5iBPqbW0=; b=OqBLnas0b3u2iphRWe03NbjI9mEC+QoYFvHc7vHsBTCAdTqXB09dyuMPCIS8LbA0/j 0MOEz5wCDpMW+v6WZ6XLrrgzkUkC1BKicdJIChrjeDRv2Em+iEtSAzfyIG+BbTBDE6hk fzfEvzyelEUH3Z2Ypa9v3zbQYTFBe+ZBJCPuhldNbksJdpFqrZRChtgu1m61RVC+sJ2Y 1DOxw9V9xxpKchaynbwuBVdJUlnED9WJtewEzwis3lo5GlIhWO1cCflU51ecb8ng70Bk iod3rOndeUw1e/Kx2WffdCIsK+fZstD5VIkhepAokhf1B3nBDBBlt1JWgOc29uEPvykc JTtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736024086; x=1736628886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/5tKgeyFg00MgtfGaAYBuFBjwqBNpORNVJY5iBPqbW0=; b=lpNJt+wl4klYaqNY6U/JkCTQfSnw3rz3ru54jmwUENELXfGdZiUcaLXdhSQDBD/f1+ irKQwgV8cv1LXY8ry2zdrRutsRaUd/0aVv/OfvCfc24WbG9xiVVZsE4qbHbwT/U3AZf1 IqBYGjD4jVd3eRoe+Bw2DmvbUf4vLeJd/iFiDS8FXcvviMvXbd5/+axcxmT0oZgWu7i0 mIRV7EOOiwAuPemMV6Ekg8YqOGTdK3NKwI6R7Y7g4u/s7mluWFC03JOCuxEamaLTC33m urejRJ9yO20d32qprBf9mvarUiRNzebbHZRp1+K5MzJstDaAzj+DjOQOxvdFZCaACFVo OiBw== X-Forwarded-Encrypted: i=1; AJvYcCWDhsf5v7fRGu5ssSi7CWMhZzf4MYZl7s6TZT1eAcuy5JjM1QrJJpKuRyiMlzZhJqKKMLwG8FPlR/A=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9eE2lgt1twk5fdTo0EjTcwJ/Y86yh9qczimtE8mY/I0WbUWJJ ic6vF5dBaUUr4q47hlyf7GySKkjgKTqfsvr2GP9FYLDVsM8E9R+8hp3XwyG3kmY= X-Gm-Gg: ASbGncuqOJQGcZQCn6MNNv2eQjrKwazsxBUWUPGarN3rqIZU+lezii5/BVHcY3GuE6f iFcYPYQW5BjL2BDZT77k+NaKe7S5RmsidM6rPdNExu1FgtP0I9viLWMHpGWURkzKNVMLSIRgTc9 EYUVLRNAB3o0QU1OGrJ9Viow/V/QIfoMAsIfRETBx01/rI0ozhRj9J5n1etQK+ZaZrAq5CfTjYq qebT7HxnXiyhvqKDstuQcGFvcC1h5xoHDKtISDP46V81KUorTUZTIpwy0N3ODnuvfSqgaU= X-Google-Smtp-Source: AGHT+IFYBTBJPclwUSGwCj06Or/uq4VGv6lfISakgOmL+cPEXrHfIpLkbx2RfKlkxwiJ7dN0dGBBQQ== X-Received: by 2002:a05:6402:2349:b0:5d0:214b:96b4 with SMTP id 4fb4d7f45d1cf-5d81dd5a17dmr16470255a12.1.1736024086537; Sat, 04 Jan 2025 12:54:46 -0800 (PST) Received: from krzk-bin.. ([178.197.223.165]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aaf4a841749sm839666666b.137.2025.01.04.12.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2025 12:54:45 -0800 (PST) From: Krzysztof Kozlowski To: Mark Brown , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , David Rhodes , Richard Fitzgerald , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com Cc: Krzysztof Kozlowski Subject: [PATCH 3/4] spi: cs42l43: Make handling missing spk-id GPIOs explicit Date: Sat, 4 Jan 2025 21:54:36 +0100 Message-ID: <20250104205437.184782-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250104205437.184782-1-krzysztof.kozlowski@linaro.org> References: <20250104205437.184782-1-krzysztof.kozlowski@linaro.org> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 gpiod_get_array_optional() for spk-id GPIOs can return NULL, if they are missing, so do not pass the value to PTR_ERR but instead explicitly treat NULL as acceptable condition. The old code was correct, but misleading because PTR_ERR usually is used on errors. Reported by Smatch: drivers/spi/spi-cs42l43.c:241 cs42l43_get_speaker_id_gpios() warn: passing zero to 'PTR_ERR' Signed-off-by: Krzysztof Kozlowski --- drivers/spi/spi-cs42l43.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-cs42l43.c b/drivers/spi/spi-cs42l43.c index ceefc253c549..90180662c4c2 100644 --- a/drivers/spi/spi-cs42l43.c +++ b/drivers/spi/spi-cs42l43.c @@ -237,7 +237,9 @@ static int cs42l43_get_speaker_id_gpios(struct cs42l43_spi *priv, int *result) int i, ret; descs = gpiod_get_array_optional(priv->dev, "spk-id", GPIOD_IN); - if (IS_ERR_OR_NULL(descs)) + if (!descs) + return 0; + else if (IS_ERR_OR_NULL(descs)) return PTR_ERR(descs); spkid = 0; From patchwork Sat Jan 4 20:54:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13926373 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 7F7221D7986 for ; Sat, 4 Jan 2025 20:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024092; cv=none; b=n5rHPgShYafrBpcSDpT38BPthIAZVBAwbhYB+ADGhw3dWShu05GmIwrigE97fcu8rz6YiTQ7rzOhfNonSuZcJP1d/+/NVVXaRLu7J+3IPf1zxgXLhWkiiJfqQhQFoYfaZFpRRWPlG/1faQt8xBgaouRHt6jwZiPm7d7YvYipIXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736024092; c=relaxed/simple; bh=KoYJDmouknRxlX7izHTU83doe8p6XKitvlO210BlS5U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gQinNt3plaPCkPavL2CP/lzPA40jeYLwu88pWicvPDeKESIQNKFgCX8gbYbni+sIv8ObC1+e5vdjCRhpdfPGYPpUGvuskCH4zFKG+PctTnp6PJufwvjNYb8skqc0amD+4x4f4gJiFIStOJ234gOWQgGxy8TPUzLAWS8v+RKCWCA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nlij1iJL; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nlij1iJL" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-aa6a38e64e4so222895066b.0 for ; Sat, 04 Jan 2025 12:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736024089; x=1736628889; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CmawReunhMQT1RzOmjM1xjN/S/KwjF4WQ4NuUA53NuA=; b=nlij1iJLZaSM+evO8c9zKTPpkE29lVavo8rdtfErtlz2i2eb3nFUKCRrluIU4URSFd dfVgSw7EMKaYBn1/w/q5SFyFegzaXg5AEc1H6TKF2agMO8qBhcIstLqxdc6/A8rq3CB0 deeGfsOZ/afk5fD2Lmz61OsUuh23r+OJq17Avtgr1RzGexcZkMXA79S6sli+f0Ua+qpa qVe6A4PxA/E/HidmMEsYbu5POlN6ZlmNnCOLYvYUfUXIjasNDybFSM5T4PlPKqxjivO1 0USawm2N2up/vxDLd3Qa/e4bh74fsyY35q6VixHAaJ4CuLml12cPiGojEOuNyZtCxdet nAkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736024089; x=1736628889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CmawReunhMQT1RzOmjM1xjN/S/KwjF4WQ4NuUA53NuA=; b=fn7ooCC3HpHy7RB6mcEU6DsSRj5jwy5VU4ZKwFdjmvkE8z8fBnztFVJ6sqr61+Ygvy bG1Ea04+FHoz4WPiJkNgROrmKgzCbasv6achFYZuhGSFAdRYzs1LvbpNZEvJGCp71StJ Rrgwl2qvMFVnR7++yxnKTsz31ndK4bj7gv74tTiM3q+Oxvi6WmGv7Ix/KD383HeGGkyT uIwxEuzp8YS8guC0vW3GUKm9OsaQLYRS2JKvgDM1an57gzTNQJEuyI5/XFeIs4iejFZ7 5OcQ6JitJ5TL7OON60q6uKdXp0LSgB282H2uZl+y8GdrMbh1gweXiAagQCMtjxE48/WR NA4Q== X-Forwarded-Encrypted: i=1; AJvYcCX1GGED3yeSIwV5UWJbDNLcHRGaPVERj5heDsHpTNW/+DfabrosifYINDOjvEvhUN7KSP336grYlyc=@vger.kernel.org X-Gm-Message-State: AOJu0YxPPkJ79HCVjb0zqpXfgrw0mbjty1fqNLAZgBiFXBd9HdSg4gJm wPfI3WjkoZ05N4bPQeQv1hUEDXzTJ7Hut8h0hv1ZMs3ixk4fhHMn+P7OQbNg0Ds= X-Gm-Gg: ASbGncsTDT+Ot+qPwLKwv2kWH/J2jASkb/MIqDjO/k5vdGA/1CSwNDN96oKdPXdWOsA R2jQOtYWp+LCB01tt8SaViCRwgT0eTkLgyxPNgy5fpWFLalBd/TxKHsHFR2bd99sDZD9fLfuAVp Hp5ow/AvTF3Qq7xLeN7xs2RRqLx1cxxlnmPQHwREFxyE34W6uqBfqCpWI//KzjeSZbnjUgGAEQN 1KOYO8TbOBPE/uqb6KF7ei72OhicAhR/CoxUi7vLUeDUFqQkirFj4IvdN6rMV59psp4KSY= X-Google-Smtp-Source: AGHT+IG0xF9hR17ga58c9EDJR/+6VF92Xk90OmLLRzHetd12T6z8pp2lmmUMDY7ynIlHUG5keK+6nQ== X-Received: by 2002:a17:907:d9e:b0:aa6:aaa8:b4a4 with SMTP id a640c23a62f3a-aac2d431db3mr1515258466b.8.1736024088851; Sat, 04 Jan 2025 12:54:48 -0800 (PST) Received: from krzk-bin.. ([178.197.223.165]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aaf4a841749sm839666666b.137.2025.01.04.12.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2025 12:54:47 -0800 (PST) From: Krzysztof Kozlowski To: Mark Brown , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , David Rhodes , Richard Fitzgerald , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com Cc: Krzysztof Kozlowski Subject: [PATCH 4/4] spi: cadence-quadspi: Assume device could match via platform Date: Sat, 4 Jan 2025 21:54:37 +0100 Message-ID: <20250104205437.184782-4-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250104205437.184782-1-krzysztof.kozlowski@linaro.org> References: <20250104205437.184782-1-krzysztof.kozlowski@linaro.org> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Driver has only of_device_id table, however it also has MODULE_ALIAS() for platform name, thus assume there is a configuration where this can be loaded outside of OF system. In such case of_device_get_match_data() will return NULL, which is already checked in one place of probe() function but not in the other, leading to Smatch warning: drivers/spi/spi-cadence-quadspi.c:1942 cqspi_probe() error: we previously assumed 'ddata' could be null (see line 1885) Driver should be consistent, so assume device can be matched via platform bus and of_device_get_match_data() can indeed return NULL. This is also possible with malformed DTS on OF-platform: no unit address and device node name matching driver name. Signed-off-by: Krzysztof Kozlowski --- drivers/spi/spi-cadence-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index 47477f2d9a25..e9197bf9d739 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1939,7 +1939,7 @@ static int cqspi_probe(struct platform_device *pdev) host->num_chipselect = cqspi->num_chipselect; - if (ddata->quirks & CQSPI_SUPPORT_DEVICE_RESET) + if (ddata && (ddata->quirks & CQSPI_SUPPORT_DEVICE_RESET)) cqspi_device_reset(cqspi); if (cqspi->use_direct_mode) {