From nobody Thu Dec 25 19:33:47 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 2CB9942A87 for ; Fri, 12 Jan 2024 06:55:30 +0000 (UTC) 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="GGlzY+o2" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-336746c7b6dso5139810f8f.0 for ; Thu, 11 Jan 2024 22:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705042529; x=1705647329; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=63UjO/yImm96QE/+VfB7fa+RlurKaZGr2phbbenRcSU=; b=GGlzY+o224Ru9J3u249etAKvOErEhzoWqH0GMAbsYHN8QY906PgEIh2/zmVgyNyAJW zyVDVtEqCwdCoYxwC4yzkKOlmYe9DZQs3Vz5ncT5ZgPh5lGUNmlTJXRJZTx8bf/PS2xu YF5UNHUWocLhF0wWgngvo+ab2xVBUKoeRKD8kiKmzhoVwDChW85loa5352xW2F29x3Bp iJe4ST+CzHyR/hPXkZf7b/eFgoJU7RgMZ9X/roJYZAPFy1RtZMRLQKzYELHKm8sry05J 1HFa+fhcwEjnkijem7cx/aCqYwEs8cZ4bN7BBr2rO7nMMLw4quW4ysGHrZXD1fDAx4Oh 2bCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705042529; x=1705647329; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=63UjO/yImm96QE/+VfB7fa+RlurKaZGr2phbbenRcSU=; b=cBYxivQDd8Ho41DJu/16go5Ixsoaa0zBZ5EsZ6kACzfWBdNJhUX308UG4qdH3xpq91 1Vr5KOiRREU51LP+gGX1zHvCTIzfn4VqWFmmA8zeGp+CYd+MGV5xI4jztk2aar2LSYCX aGBMqO6hiaIMDduLvyKAm1E6RXzm/N40Y8rf/LPVBm+NFY1ohFv4e2V88ObzLvIkCD/0 0HGOfJBApjbLK0/rjaFLWtf2R0r2m6Tp0BHgfKnTXY+jh5BAHU19AhORiqTCOt0QytAZ rgF1Njf2NN3G3VnVywbSVPKchAHdRVtUlCMyCWc1a3qpnYQHFpShQOE7J5tNyfO7mFlQ 93jg== X-Gm-Message-State: AOJu0YxOBcAS5Kkz1UiY7lsKU+KSN0yZr1XgntxWdbWFOB39B9BOVclp 4XBujnhR+VBQKg8ggSKfOIXWV0ZpWjkFAA== X-Google-Smtp-Source: AGHT+IFYyXyn3K/JOwDJilFEclpAaIimSSiow+hzHZK4+0CXb3Se3RROQAPmH0iur0XUlIjkKHaeUA== X-Received: by 2002:a5d:590f:0:b0:337:7680:8ccf with SMTP id v15-20020a5d590f000000b0033776808ccfmr453616wrd.56.1705042529315; Thu, 11 Jan 2024 22:55:29 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id d18-20020a5d6452000000b0033761b2de64sm2986699wrw.76.2024.01.11.22.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 22:55:28 -0800 (PST) Date: Fri, 12 Jan 2024 09:55:25 +0300 From: Dan Carpenter To: Tzuyi Chang Cc: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] gpio: rtd: Fix signedness bug in probe Message-ID: <46566e85-4afa-4c55-93b2-0d0b71d76b12@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The "data->irqs[]" array holds unsigned int so this error handling will not work correctly. Fixes: eee636bff0dc ("gpio: rtd: Add support for Realtek DHC(Digital Home C= enter) RTD SoCs") Signed-off-by: Dan Carpenter Reviewed-by: Linus Walleij --- drivers/gpio/gpio-rtd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-rtd.c b/drivers/gpio/gpio-rtd.c index a7939bd0aa56..bf7f008f58d7 100644 --- a/drivers/gpio/gpio-rtd.c +++ b/drivers/gpio/gpio-rtd.c @@ -525,18 +525,21 @@ static int rtd_gpio_probe(struct platform_device *pde= v) struct device *dev =3D &pdev->dev; struct gpio_irq_chip *irq_chip; struct rtd_gpio *data; + int ret; =20 data =3D devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; =20 - data->irqs[0] =3D platform_get_irq(pdev, 0); - if (data->irqs[0] < 0) - return data->irqs[0]; + ret =3D platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + data->irqs[0] =3D ret; =20 - data->irqs[1] =3D platform_get_irq(pdev, 1); - if (data->irqs[1] < 0) - return data->irqs[1]; + ret =3D platform_get_irq(pdev, 1); + if (ret < 0) + return ret; + data->irqs[1] =3D ret; =20 data->info =3D device_get_match_data(dev); if (!data->info) --=20 2.43.0