>-----Original Message----- >From: Alison Schofield <alison.schofield@xxxxxxxxx> >Sent: 10 March 2025 20:29 >To: Shiju Jose <shiju.jose@xxxxxxxxxx> >Cc: linux-cxl@xxxxxxxxxxxxxxx; dan.j.williams@xxxxxxxxx; dave@xxxxxxxxxxxx; >Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>; dave.jiang@xxxxxxxxx; >vishal.l.verma@xxxxxxxxx; ira.weiny@xxxxxxxxx; david@xxxxxxxxxx; >Vilas.Sridharan@xxxxxxx; linux-edac@xxxxxxxxxxxxxxx; linux- >acpi@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; >bp@xxxxxxxxx; tony.luck@xxxxxxxxx; rafael@xxxxxxxxxx; lenb@xxxxxxxxxx; >mchehab@xxxxxxxxxx; leo.duran@xxxxxxx; Yazen.Ghannam@xxxxxxx; >rientjes@xxxxxxxxxx; jiaqiyan@xxxxxxxxxx; Jon.Grimm@xxxxxxx; >dave.hansen@xxxxxxxxxxxxxxx; naoya.horiguchi@xxxxxxx; >james.morse@xxxxxxx; jthoughton@xxxxxxxxxx; somasundaram.a@xxxxxxx; >erdemaktas@xxxxxxxxxx; pgonda@xxxxxxxxxx; duenwen@xxxxxxxxxx; >gthelen@xxxxxxxxxx; wschwartz@xxxxxxxxxxxxxxxxxxx; >dferguson@xxxxxxxxxxxxxxxxxxx; wbs@xxxxxxxxxxxxxxxxxxxxxx; >nifan.cxl@xxxxxxxxx; tanxiaofei <tanxiaofei@xxxxxxxxxx>; Zengtao (B) ><prime.zeng@xxxxxxxxxxxxx>; Roberto Sassu <roberto.sassu@xxxxxxxxxx>; >kangkang.shen@xxxxxxxxxxxxx; wanghuiqiang <wanghuiqiang@xxxxxxxxxx>; >Linuxarm <linuxarm@xxxxxxxxxx> >Subject: Re: [PATCH 1/8] cxl: Add helper function to retrieve a feature entry > >On Mon, Mar 10, 2025 at 06:15:38PM +0000, Shiju Jose wrote: >> >-----Original Message----- >> >From: Alison Schofield <alison.schofield@xxxxxxxxx> >> >Sent: 07 March 2025 19:20 >> >To: Shiju Jose <shiju.jose@xxxxxxxxxx> >> [...] >> >> +struct cxl_feat_entry *cxl_get_feature_entry(struct cxl_dev_state *cxlds, >> >> + const uuid_t *feat_uuid) { >> >> + struct cxl_features_state *cxlfs = to_cxlfs(cxlds); >> >> + struct cxl_feat_entry *feat_entry; >> >> + int count; >> >> + >> >> + /* >> >> + * Retrieve the feature entry from the supported features list, >> >> + * if the feature is supported. >> >> + */ >> >> + feat_entry = cxlfs->entries->ent; >> > >> >Do we need some NULL checking here on cxlfs, entries >> >> Hi Alison, >> >> Thanks for the feedbacks. >> We had check on cxlfs before >> https://lore.kernel.org/all/20250122235159.2716036-5-dave.jiang@intel. >> com/ but removed because of the following comment. >> https://lore.kernel.org/all/20250124150150.GZ5556@xxxxxxxxxx/ > >Hi Shiju, Hi Alison, > >I have not followed all along, so yeah my questions may be a bit pesky at this >point. I did see the comment linked above about how the driver must be bound >at this point. I think my question is a bit different. The feedback was added to remove defensive checks present in this function. > >Are each of these guaranteed not to be NULL here: > >to_cxlfs(cxlds) to_cxlfs(cxlds) cannot be NULL if cxl_get_feature_entry() is called after devm_cxl_setup_features(), otherwise will be NULL. >cxlfs->entries >cxlfs->entries->ent Both fields will be NULL if the firmware does not support any features. > >If these cannot be NULL, then all good. > >--Alison > [...] >> Thanks, Shiju