Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7274313rwp; Tue, 18 Jul 2023 12:41:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGQSAe9ljYz7XuVkP1aO8QowRi3/3mhaQtPEZEEapkxeOVuzE4DdZXUQhAR/peUMXkOdZGN X-Received: by 2002:a17:906:18:b0:994:34a2:8724 with SMTP id 24-20020a170906001800b0099434a28724mr621043eja.52.1689709300726; Tue, 18 Jul 2023 12:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689709300; cv=none; d=google.com; s=arc-20160816; b=q6MvpOtbUawvfippJyue2dznynkjLrqkZ8ykDL0jSqXCh7GhrzcRkq+xVSJlq0EKSP qKtH0qoEpWvtk6qExgWMlHMCAQ4bySo28okzavUAVZGF/qOc0CvOGM2euY3/5yHu2oYP StptsYVyYOYYVl2dPbwzj9IMlflIc0oRSHW7nSKwBy0CZHLejisRvUmLefboB862Q9Y2 Tb/emTOKHCTyNTXFWkxi6Kd/2gMQOmVO29K/ofNvazoh23YIfZFdbsnRpgbvxU+XiBXM 4h+YEOY3OSoBeNP+G4Q1JWXKlBhfFaZcv5KtHTOBWui0OKr9JWwv4DE1KkRxVHc27koB M2JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=iTrSAnnMNi3CJrN72jg6c2jFERcFPh+1lB6HHppzE2o=; fh=wkoisEo0d/I2i4ztlk+oFpiKe80e2czQUpnwIp44GSc=; b=v9Y0CZBpBtcRB++ljSz8OO08tlytt4jbzCGvSWXJakQjv65ZTi9omw2hBfPN7KHRaw ceWxasHiTGpKwKfSgGS1JJe/QrjsMQG8EjBKnKT4t7awPxIVJcJoHqgqBy/InLtiWbDw vHTK07KbmYWk/emUhdMqx1XAfGoUXzpRnVZP8jy6Jmfr3/YiaYKLuBVFVQVBKVbp4kZZ xD7PWhrats0iVYHV+8yhx16eFSgN9TwRBuLOmt10jr4DEL1t09BK0qQHIjNsJQJAdWxp MBzkgY7N475G92YhoYdHaY7xM1z9QW4JtiAAax5NocWhyyvuMTSIVwEZAf0nqZQJ6IaQ 4a9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YstOd1W6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qn8-20020a170907210800b00992ee6da8e7si1528418ejb.740.2023.07.18.12.41.06; Tue, 18 Jul 2023 12:41:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YstOd1W6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbjGRTbN (ORCPT + 99 others); Tue, 18 Jul 2023 15:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjGRTbN (ORCPT ); Tue, 18 Jul 2023 15:31:13 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BC76198E; Tue, 18 Jul 2023 12:31:12 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b6fdaf6eefso93029531fa.0; Tue, 18 Jul 2023 12:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689708670; x=1692300670; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iTrSAnnMNi3CJrN72jg6c2jFERcFPh+1lB6HHppzE2o=; b=YstOd1W6X1vyeMfDJmOipRaiIKM3IzxuY+kVIN/FOQeM6+H/CIXHfev4VHYQDS7zaR 0kkXOJNSctTui42cWYPOOZUpWLOsizTbde2fZeUuqjApV9AYOBavHGPoqPjEihsrceJ9 MU3Z0Ghyv+GV5CnWqWUaOH6UijQkEiUHlOEkacpTf5roK4x3DanRGNJCVFPQ9fNmrMqK X4PF/vBNHywJmm+QqMtWs9Y1kHdK5fNHP98DS6PeU48OWxFWe3UTfXSMGN9llTvi3cey /1/1VQeRp1rh86mVF3atw9KlljWG1Yi6ZdEKQZmHZgtt/T4iHKVnul9V8byJrn+GPu4n VglA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689708670; x=1692300670; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iTrSAnnMNi3CJrN72jg6c2jFERcFPh+1lB6HHppzE2o=; b=SFHhAqwEmoy63AGN3qkHJ1jfr7mYtHCwUFT+URt1EE6BpUkzWHtuRQizTnS/b14Oh8 bGXRnv0dYUl9aOPxauhLcmc+ARd6J5NfdmGaiVKyY4W4VcPwdXrgx1K1CET/EsuWhL5Z aC3lmXmjwf2KCdfagYzKfV/0D1l3YRUbAygP8x87UHK4jezxkfTDRFEBPiLTO17LXp+y pAMEFeHXBGhlkBAJexqHxPCJ68qzaPNKJBQe4ijpVLku4SO8lDecFNOcWYKFG6AIuyyJ yzRy/eCcVWlbzquAULwKB6LOgO5rK4LWxrmSdqpMsP50ppjOsdRTBOHjmxL400KHK8HA jifg== X-Gm-Message-State: ABy/qLYv4gx4IwIOjH74jfoCCqqI+O0lRYMIplKCVXoCgAqzywirTwpm Bc3tb5dEk267RWDUhXvPrpZv1nDpmmFFd38UNCyDfkVq X-Received: by 2002:a2e:b611:0:b0:2b7:2066:10e1 with SMTP id r17-20020a2eb611000000b002b7206610e1mr11095537ljn.0.1689708670027; Tue, 18 Jul 2023 12:31:10 -0700 (PDT) MIME-Version: 1.0 References: <5cbde2b4-69b5-4b25-a095-251c8347cb09@kili.mountain> In-Reply-To: <5cbde2b4-69b5-4b25-a095-251c8347cb09@kili.mountain> From: Luiz Augusto von Dentz Date: Tue, 18 Jul 2023 12:30:57 -0700 Message-ID: Subject: Re: [PATCH] Bluetooth: hci_conn: clean up some casts To: Dan Carpenter Cc: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Dan, On Mon, Jul 17, 2023 at 3:20=E2=80=AFAM Dan Carpenter wrote: > > The ERR_PTR/PTR_ERR() functions are only for error pointers. They're > not a generic way to cast pointers to int. > > Signed-off-by: Dan Carpenter > --- > We should really create INT_PTR/PTR_INT() functions. But this is a > cleanup until someone creates those. Is there any reason you didn't create such macros? I mean we could have it local first, or perhaps we just do HANDLE_PTR/PTR_HANDLE to avoid any confusion. > net/bluetooth/hci_conn.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c > index cccc2b8b60a8..aea6fa12d954 100644 > --- a/net/bluetooth/hci_conn.c > +++ b/net/bluetooth/hci_conn.c > @@ -873,7 +873,7 @@ static void bis_cleanup(struct hci_conn *conn) > > static int remove_cig_sync(struct hci_dev *hdev, void *data) > { > - u8 handle =3D PTR_ERR(data); > + u8 handle =3D (unsigned long)data; > > return hci_le_remove_cig_sync(hdev, handle); > } > @@ -882,7 +882,7 @@ static int hci_le_remove_cig(struct hci_dev *hdev, u8= handle) > { > bt_dev_dbg(hdev, "handle 0x%2.2x", handle); > > - return hci_cmd_sync_queue(hdev, remove_cig_sync, ERR_PTR(handle),= NULL); > + return hci_cmd_sync_queue(hdev, remove_cig_sync, (void *)(unsigne= d long)handle, NULL); > } > > static void find_cis(struct hci_conn *conn, void *data) > @@ -1234,7 +1234,7 @@ void hci_conn_failed(struct hci_conn *conn, u8 stat= us) > static void create_le_conn_complete(struct hci_dev *hdev, void *data, in= t err) > { > struct hci_conn *conn; > - u16 handle =3D PTR_ERR(data); > + u16 handle =3D (unsigned long)data; > > conn =3D hci_conn_hash_lookup_handle(hdev, handle); > if (!conn) > @@ -1264,7 +1264,7 @@ static void create_le_conn_complete(struct hci_dev = *hdev, void *data, int err) > static int hci_connect_le_sync(struct hci_dev *hdev, void *data) > { > struct hci_conn *conn; > - u16 handle =3D PTR_ERR(data); > + u16 handle =3D (unsigned long)data; > > conn =3D hci_conn_hash_lookup_handle(hdev, handle); > if (!conn) > @@ -2854,7 +2854,7 @@ u32 hci_conn_get_phy(struct hci_conn *conn) > static int abort_conn_sync(struct hci_dev *hdev, void *data) > { > struct hci_conn *conn; > - u16 handle =3D PTR_ERR(data); > + u16 handle =3D (unsigned long)data; > > conn =3D hci_conn_hash_lookup_handle(hdev, handle); > if (!conn) > -- > 2.39.2 > --=20 Luiz Augusto von Dentz